torch / torch7

http://torch.ch
Other
8.97k stars 2.38k forks source link

error calling require of a function from different file #968

Closed LubnaM1 closed 7 years ago

LubnaM1 commented 7 years ago

HI all , I'm new to torch so I'm not sure why I'm getting error when trying to call another function from different file,the new file AE.lua is in subdirectory (models) of the main file. require("models.AE") gives this error

/torch/install/share/lua/5.1/trepl/init.lua:389: module 'models.AE' not found:No LuaRocks module found for models.AE no field package.preload['models.AE'] no file '/home/lubna/.luarocks/share/lua/5.1/models/AE.lua' no file '/home/lubna/.luarocks/share/lua/5.1/models/AE/init.lua' no file '/home/lubna/torch/install/share/lua/5.1/models/AE.lua' stack traceback: [C]: in function 'error' /home/lubna/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require' [string "_RESULT={require("models.AE")}"]:1: in main chunk [C]: in function 'xpcall' /home/lubna/torch/install/share/lua/5.1/trepl/init.lua:661: in function 'repl' ...ubna/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk [C]: at 0x00405d50

Thanks

iacolippo commented 7 years ago

I can load functions using require('subdir.namefile'). It's hard to see the problem without seeing your directory structure.

Can you please help me visualize it?

LubnaM1 commented 7 years ago

Hi, Thanks, I found the problem, there was a mix up with the directory locations . Thanks