Skip to content

Instantly share code, notes, and snippets.

@karino2
karino2 / notebook.sh
Last active December 20, 2017 04:28
For execution from android phone.
# notebook.sh
#!/bin/sh
jupyter-notebook --ip=0.0.0.0 2>&1 | tee notebook_output.log | sed -n "/^ *http.*8888/s/ *http.*token=//p"
# note_on_docker.sh
#!/bin/bash
pushd ~/ClassSim;
docker run -it --rm --publish 52688:8888 --publish 6006:6006 -v $(pwd):/work arino/tfcpu2 /work/notebook.sh
@karino2
karino2 / matmul.cu
Last active January 1, 2018 13:24
Matrix Multiplication for CUDA explanation
#include "util.h"
#define TILE_WIDTH 16
// Compute C = A * B
__global__ void matrixMultiplyShared(float* A, float* B, float* C,
int numARows, int numACols,
int numBRows, int numBCols,
int numCRows, int numCCols)
{
@karino2
karino2 / linear.cu
Last active January 16, 2018 14:23
For screen shot
__global__ void linear(float* x,
int numXRows, int numXCols)
{
__shared__ float W [TILE_WIDTH][TILE_WIDTH];
__shared__ float b [TILE_WIDTH][TILE_WIDTH];
// x*W+b
}
<us-patent-grant lang="EN" dtd-version="v4.2 2006-08-23" file="US08160929-20120417.XML" status="PRODUCTION" id="us-patent-grant" country="US" date-produced="20120403" date-publ="20120417">
<us-bibliographic-data-grant>
<publication-reference>
<document-id>
<country>US</country>
<doc-number>08160929</doc-number>
<kind>B1</kind>
<date>20120417</date>
</document-id>
</publication-reference>
<!DOCTYPE us-patent-application SYSTEM "us-patent-application-v44-2014-04-03.dtd" [ ]>
<us-patent-application lang="EN" dtd-version="v4.4 2014-04-03" file="US20170347517A1-20171207.XML" status="PRODUCTION" id="us-patent-application" country="US" date-produced="20171121" date-publ="20171207">
<us-bibliographic-data-application lang="EN" country="US">
<publication-reference>
<document-id>
<country>US</country>
<doc-number>20170347517</doc-number>
<kind>A1</kind>
<date>20171207</date>
</document-id>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/mman.h>
#include "parser.h"
#include "test_util.h"
extern int eval(int r0, int r1, char *str);
@karino2
karino2 / tegashiki_model.py
Last active July 4, 2019 01:27
Tegashiki model
DROPOUT_RATE=0.5
L2_REGULARIZATION_RATE=0.1
FEATURE_EXTRACTER_KERNEL_SIZE=7
FILTER_NUM=128
KERNEL_SIZE=5
# model_small
DROPOUT_RATE=0.5
L2_REGULARIZATION_RATE=0.1
EXTRACTED_FETURE_DIM=256
FEATURE_EXTRACTER_KERNEL_SIZE=7
GRU_HIDDEN=256
# tpu_model_fn also modify for update moving avg.
def fe_conv1d(filternum, kernelsize, x):
char_names = ["A","B","C","E","F","G","H","I","L","M","N",
"P","R", "S","T","V","X","Y",
"a","b", "c","d", "e", "f","g","h", "i",
"j","k","l","m", "n","o","p","q","r","s","t", "u",
"v","w","x","y", "z",
"\\alpha","\\beta","\\gamma","\\phi","\\mu",
"\\lambda","\\sigma", "\\pi", "\\theta"]
binop_names = ["+", "-", "\\times", "\\div", "\\pm"]
eqop_names = ["\\geq", ">", "\\leq", "<", "="]
nonzero_num_names = [str(i) for i in range(1, 10)]
VOCAB_SIZE=115
MAX_ONE_STROKE_LEN=50
MAX_STROKE_NUM=22
MAX_TOKEN_LEN=10+2
# must match to trained dim
EXTRACTED_FEATURE_DIM=256
FE_DROPOUT_RATE=0.5
FE_L2_REGULARIZATION_RATE=0.01