GithubHelp home page GithubHelp logo

forces's People

Contributors

roozbehm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

avijit9

forces's Issues

rnnUnit

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?

Move to Apache 2.0 license

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.