allenai / forces Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I'm afraid I can't get the RNN part of the code to work. The code below is the rnn function I copied and pasted from the repo. Next I add code from the RNNLayers.lua. This should give me just the RNN part of the model. The input to the model = {torch.rand(4096*2),torch.rand(1000)}
require 'nn'
function rnn(inDim, hidDim, outDim , rho, shared)
local function SelectRange(m,n)
local C = nn.ConcatTable()
for i= m,n do
C:add(nn.SelectTable(i))
end
return C
end
local function JoinTable_firstTwo(dim)
local C = SelectRange(1,2)
return nn.Sequential():add(C):add(nn.JoinTable(dim))
end
local function joinUnit()
return nn.Sequential():add(JoinTable_firstTwo(2)):add(nn.Linear(inDim+hidDim,hidDim)):add(nn.ReLU(true))
end
local function maxUnit()
return nn.Sequential():add(nn.SelectTable(2)):add(nn.Linear(hidDim,outDim))
end
local rnnUnit = nn.Sequential()
for i=1,rho do
hidUnit = nn.ConcatTable()
:add(nn.SelectTable(1))
:add(joinUnit())
:add(maxUnit())
if i>1 then
for j=1,i-1 do
hidUnit:add(nn.SelectTable(2+j))
end
end
rnnUnit:add(hidUnit)
end
rnnUnit:add(SelectRange(3,2+rho))
if shared == true then
local linUnits = rnnUnit:findModules('nn.Linear')
for i=3,#linUnits,2 do
linUnits[i] = linUnits[1];
linUnits[i+1] =linUnits[2]
end
end
return rnnUnit
end
config ={}
config.force_size = 4096
config.rho = 6
config.RNNhSize = 1000;
config.RNNoSize = 18;
config.nCategories = 18;
local start = nn.ConcatTable()
:add(nn.Identity())
:add(nn.Sequential():add(nn.Linear(4096+config.force_size,config.RNNhSize)):add(nn.ReLU(true)))
local model= nn.Sequential():add(start):add(rnn(4096+config.force_size, config.RNNhSize, config.RNNoSize, config.rho, false))
local input = torch.rand(4096*2)
model:forward(input)
Here is the error:
bad argument #2 to '?' (out of bounds at /Users/jsuit/torch/pkg/torch/lib/TH/generic/THStorage.c:202)
stack traceback:
[C]: at 0x04526e60
[C]: in function '__index'
/lua/5.1/nn/JoinTable.lua:30: in function
<lua/5.1/nn/JoinTable.lua:21>
[C]: in function 'xpcall'
/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/lua/5.1/nn/Sequential.lua:44: in function
</lua/5.1/nn/Sequential.lua:41>
[C]: in function 'xpcall'
/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/lua/5.1/nn/Sequential.lua:44: in function <lua/5.1/nn/Sequential.lua:41>
[C]: in function 'xpcall'
lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
/lua/5.1/nn/ConcatTable.lua:11: in function
<lua/5.1/nn/ConcatTable.lua:9>
[C]: in function 'xpcall'
/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors'
lua/5.1/nn/Sequential.lua:44: in function 'forward'
/rnnUnit.lua:61: in main chunk
[C]: in function 'dofile'
install/lib/luarocks/rocks/trepl/scm-1/bin/th:145: in main chunk
[C]: at 0x01041ff1c0
I can't figure out what I'm doing wrong. Is it me or is there something wrong with the code in the repo?
Have you implemented this paper in Pytorch too?
To move to the Apache 2.0 license, please list the current dependencies of this project and their licenses. Then, if we don't have any licensing conflicts we just need to update the documentation and create a LICENSE file at the root of the project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.