Skip to content

Instantly share code, notes, and snippets.

@karino2
karino2 / iconresize_tasks.py
Last active April 17, 2021 04:44
Resize android icon, invoke based. Use Pillow.
from invoke import task
# pip install Pillow
from PIL import Image
import os
@task(help={"src": "元のサイズのpngファイル",
"dest": "置く先のディレクトリ",
"size": "解像度。192, 144, 96, 72, 48のどれか"})
def resize_and_move(c, src, dest, size):
@karino2
karino2 / notebook.sh
Created February 6, 2020 13:09
From docker container.
#!/bin/sh
# used from docker image
jupyter-notebook --ip=`ip route | awk 'NR==2 {print $9}'`
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
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)]
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):
@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
#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);
<!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>
<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>
@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
}