Error while using Conv2DLayer with lasagne NeuralNet

£可爱£侵袭症+ 提交于 2019-12-10 15:55:44

问题


I have windows 8.1 64bit and use recommended here http://deeplearning.net/software/theano/install_windows.html#installing-theano python win-python distribution (python 3.4). I've went through every step of tutorial (excluding CUDA stuff and GPU config), uninstalled everything and did it again but my problem persists. I am trying to build convolutional neural network using Lasagne. Every layer I've tested so far is working - only Conv2DLayer throws errors. Code is as follows:

net2 = NeuralNet(
layers=[
    ('input', layers.InputLayer),
    ('conv1', layers.Conv2DLayer),
    ('pool1', layers.MaxPool2DLayer),
    ('hidden4', layers.DenseLayer),
    ('hidden5', layers.DenseLayer),
    ('output', layers.DenseLayer),
    ],
input_shape=(None, 1, 96, 96),
conv1_num_filters=32, conv1_filter_size=(3, 3),
pool1_pool_size=(2, 2),
hidden4_num_units=500, hidden5_num_units=500,
output_num_units=30, output_nonlinearity=None,
update_learning_rate=0.01,
update_momentum=0.9,
regression=True,
max_epochs=400,
verbose=1,
)

Below I have pasted the error that I get. I suppose that something is wrong with gcc (I got exact version from tutorial) but can't really figure out what is the problem. I have bleeding edge versions of lasagne/theano. I've tried both Anaconda and WinPython distributions. I've tried both with python 2.7 and 3.4 and can not really find any solution to this problem. Nets with only dense/maxPooling layers are running just fine. I would be grateful for any suggestions that would help me to resolve this issue.

Error Message:

Problem occurred during compilation with the command line below:
g++.exe -shared -g -O3 -fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -march=haswell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=haswell -D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\numpy\core\include -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\include -IC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof -o C:\Users\Michal\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\tmpgdh7ov2i\mf217e5b3a6b61b4ef70844368439f6cb.pyd C:\Users\Michal\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\tmpgdh7ov2i\mod.cpp -LC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\libs -LC:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64 -lpython34
Traceback (most recent call last):

  File "", line 1, in 
    net2.fit(X, y)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 457, in fit
    self.initialize()

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 303, in initialize
    self.y_tensor_type,

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\nolearn\lasagne\base.py", line 435, in _create_iter_funcs
    allow_input_downcast=True,

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function.py", line 317, in function
    output_keys=output_keys)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\pfunc.py", line 526, in pfunc
    output_keys=output_keys)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function_module.py", line 1778, in orig_function
    defaults)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\compile\function_module.py", line 1642, in create
    input_storage=input_storage_lists, storage_map=storage_map)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\link.py", line 690, in make_thunk
    storage_map=storage_map)[:3]

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\vm.py", line 1037, in make_all
    no_recycling))

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\op.py", line 932, in make_thunk
    no_recycling)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\op.py", line 850, in make_c_thunk
    output_storage=node_output_storage)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1207, in make_thunk
    keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1152, in __compile__
    keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1602, in cthunk_factory
    key=key, lnk=self, keep_lock=keep_lock)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cmodule.py", line 1174, in module_from_key
    module = lnk.compile_cmodule(location)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cc.py", line 1513, in compile_cmodule
    preargs=preargs)

  File "C:\scisoft\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\site-packages\theano\gof\cmodule.py", line 2187, in compile_str
    (status, compile_stderr.replace('\n', '. ')))

Exception: ('The following error happened while compiling the node', CorrMM{valid, (1, 1)}(input.input, Subtensor{::, ::, ::int64, ::int64}.0), '\n', "Compilation failed (return status=1): C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp: In member function 'int {anonymous}::__struct_compiled_op_mf217e5b3a6b61b4ef70844368439f6cb::run()':\r. C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp:947:16: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]\r.              kH = NULL;\r.                 ^\r. C:\\Users\\Michal\\AppData\\Local\\Theano\\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64\\tmpgdh7ov2i\\mod.cpp:958:16: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]\r.              kW = NULL;\r.                 ^\r. C:\\Users\\Michal\\AppData\\Local\\Temp\\cc67su6o.o: In function `corrMM(tagPyArrayObject*, tagPyArrayObject*, tagPyArrayObject*, int, int, int, int, int)':\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:431: undefined reference to `dgemm_'\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:528: undefined reference to `dgemm_'\r. C:/Users/Michal/AppData/Local/Theano/compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.4.3-64/tmpgdh7ov2i/mod.cpp:483: undefined reference to `dgemm_'\r. collect2.exe: error: ld returned 1 exit status\r. ", '[CorrMM{valid, (1, 1)}(input.input, )]')

回答1:


I managed to solve my issue by following steps given by IshanAntony on this website https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13973/a-few-tips-to-install-theano-on-windows-64-bits/98833 . Apparently Theano had problem with linking BLAS correctly so I downloaded and used open-BLAS and error vanished (links and steps needed to download and configure OPEN-BLAS can be found in IshanAntony's answer).



来源:https://stackoverflow.com/questions/34572414/error-while-using-conv2dlayer-with-lasagne-neuralnet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!