Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block taey16

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
taey16 /
Last active Oct 11, 2016
import numpy as np
import sys
import as sio
def sample(hprev, xt, n):
for index in xt:
x = np.zeros((vocab_size, 1))
x[index] = 1
h = np.tanh(, x) +, hprev) + bh)
y =, h) + by
taey16 /
Last active Jul 4, 2018
import numpy as np
import sys
import caffe
from caffe import caffe_utils as utils
import datetime
taey16 / lr_per_layer.lua
Created Oct 25, 2015
Assign different learning rate for a layer
View lr_per_layer.lua
-- suppose you have a model called model
lrs_model = model:clone()
lrs = lrs_model:getParameters()
lrs:fill(1) -- setting the base learning rate to 1
-- now lets set the learning rate factor of the bias of module 5 to 2
-- same thing for the weights of module 2, let's set them to 3
View convertLiner2Conv.lua
require 'nn'
-- you just need to provide the linear module you want to convert,
-- and the dimensions of the field of view of the linear layer
function convertLinear2Conv1x1(linmodule,in_size)
local s_in = linmodule.weight:size(2)/(in_size[1]*in_size[2])
local s_out = linmodule.weight:size(1)
local convmodule = nn.SpatialConvolutionMM(s_in,s_out,in_size[1],in_size[2],1,1)
#!/usr/bin/env python
import numpy
import sys
import timeit
import numpy.core._dotblas
print 'FAST BLAS'
except ImportError:
print 'slow blas'
taey16 / convert_vgg.lua
Last active Aug 18, 2016
View convert_vgg.lua
require 'loadcaffe'
require 'nn'
local model_root = '/storage/models/vgg'
local deploy_file = paths.concat(model_root, 'vgg_layer16_deploy.prototxt')
local weight_file = paths.concat(model_root, 'vgg_layer16.caffemodel')
local model = loadcaffe.load(deploy_file, weight_file, nn)
return model
You can’t perform that action at this time.