Last active
February 14, 2017 10:29
-
-
Save paidi/310d2d869ef74794b239 to your computer and use it in GitHub Desktop.
Batch SparseLinear
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = nn.ParallelTable() | |
layer = nn.SparseLinear(inputSize,outputSize) | |
m:add(nn.Sequential():add(layer):add(nn.Reshape(1,outputSize))) | |
for i=2,batchSize do | |
local repLayer = layer:clone('weight', 'bias', 'gradWeight', 'gradBias') | |
m:add(nn.Sequential():add(repLayer):add(nn.Reshape(1,outputSize))) | |
end | |
batchLayer = nn.Sequential():add(m):add(nn.JoinTable(1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment