Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing weight-init.lua #27

Open
singam-sanjay opened this issue Sep 22, 2017 · 0 comments
Open

Installing weight-init.lua #27

singam-sanjay opened this issue Sep 22, 2017 · 0 comments

Comments

@singam-sanjay
Copy link

I need to use weight-init.lua in my project and would prefer to use it in a clean way, e.g. by placing it in the search path of th.

To this end, I created a directory named "weight-init" under /extra and copied the contents of torch-toolbox/Weight-Init into it and made appropriate changes to /extra/CMakeLists.txt and added /extra/weight-init/CMakeLists.txt`

diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt
index 903ff3b..94ff2ed 100644
--- a/extra/CMakeLists.txt
+++ b/extra/CMakeLists.txt
@@ -5,6 +5,7 @@ ADD_SUBDIRECTORY(nngraph)
 ADD_SUBDIRECTORY(nnx)
 ADD_SUBDIRECTORY(threads)
 ADD_SUBDIRECTORY(argcheck)
+ADD_SUBDIRECTORY(weight-init)

 IF (WITH_CUDA STREQUAL ON)
  ADD_SUBDIRECTORY(cutorch)
diff --git a/extra/weight-init/CMakeLists.txt b/extra/weight-init/CMakeLists.txt
new file mode 100644
index 0000000..2b2ad94
--- /dev/null
+++ b/extra/weight-init/CMakeLists.txt
@@ -0,0 +1,11 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
+CMAKE_POLICY(VERSION 2.6)
+
+FIND_PACKAGE(Torch REQUIRED)
+
+FILE(GLOB luasrc *.lua)
+
+ADD_TORCH
```_PACKAGE(weight-init "" "${luasrc}")
+

But, "weight-init.lua" is nowhere to be seen in th's search path,

th> require('weight-init')(1, 'xavier_caffe')
...user/Software/torch/install/share/lua/5.1/trepl/init.lua:389: module 'weight-init' not found:No LuaRocks module found for weight-init
        no field package.preload['weight-init']
        no file '/home/user/.luarocks/share/lua/5.1/weight-init.lua'
        no file '/home/user/.luarocks/share/lua/5.1/weight-init/init.lua'
        no file '/home/user/Software/torch/install/share/lua/5.1/weight-init.lua'
        no file '/home/user/Software/torch/install/share/lua/5.1/weight-init/init.lua'
        no file './weight-init.lua'
        no file '/home/user/Software/torch/install/share/luajit-2.1.0-beta1/weight-init.lua'
        no file '/usr/local/share/lua/5.1/weight-init.lua'
        no file '/usr/local/share/lua/5.1/weight-init/init.lua'
        no file '/home/user/.luarocks/lib/lua/5.1/weight-init.so'
        no file '/home/user/Software/torch/install/lib/lua/5.1/weight-init.so'
        no file '/home/user/Software/torch/install/lib/weight-init.so'
        no file './weight-init.so'
        no file '/usr/local/lib/lua/5.1/weight-init.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'error'
        ...user/Software/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
        [string "_RESULT={require('weight-init')(1, 'xavier_ca..."]:1: in main chunk
        [C]: in function 'xpcall'
        ...user/Software/torch/install/share/lua/5.1/trepl/init.lua:661: in function 'repl'
        ...ware/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:204: in main chunk
        [C]: at 0x00406651

What am I missing in CMakeLists ? Or is there another way access this function in a clean way ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant