tscohen / GrouPy

Group Equivariant Convolutional Neural Networks
http://ta.co.nl
Other
349 stars 85 forks source link

Updates to work with Chainer 5.1.0 and Python 3 #18

Open sometimescasey opened 5 years ago

sometimescasey commented 5 years ago

The following changes allowed me to run gconv_experiments using:

Addresses many of the issues mentioned in #13 .

Feel free to close PR if you don't want to merge, but I thought I'd put this here for others who might find it useful. Thanks!

Ning0Luo commented 5 years ago

Hi, I use python Python 2.7.15 and I change the code according to this. But one error is thrown out as the following: AttributeError: 'module' object has no attribute 'Reshape Is there any way to solve that?

sometimescasey commented 5 years ago

@Ning0Luo unfortunately all my changes above were tested against Python 3.6.7, and I'm not sure what specific versions of the necessary packages you're using. I suspect you just need to upgrade a package. Do you have the full stacktrace, so we can see what specific line threw that error?

Ning0Luo commented 5 years ago

Hi, the full stack trace is the following: groupy.garray.test_garray.test_p4_array ... ok groupy.garray.test_garray.test_p4m_array ... ok groupy.garray.test_garray.test_z2_array ... ok groupy.garray.test_garray.test_z3_array ... ok groupy.garray.test_garray.test_c4_array ... ok groupy.garray.test_garray.test_d4_array ... ok groupy.garray.test_garray.test_o_array ... ok groupy.garray.test_garray.test_c4h_array ... ok groupy.garray.test_garray.test_c4ht_array ... ok groupy.garray.test_garray.test_d4h_array ... ok groupy.garray.test_garray.test_d4ht_array ... ok groupy.garray.test_garray.test_oh_array ... ok groupy.garray.test_garray.test_ot_array ... ok groupy.garray.test_garray.test_oht_array ... ok groupy.gconv.chainer_gconv.kernels.test_integer_indexing_cuda_kernel.test_index_group_func ... ok groupy.gconv.chainer_gconv.test_gconv.test_p4_net_equivariance ... /home/ning_luo/GrouPy/groupy/gfunc/gfuncarray.py:78: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; usearr[tuple(seq)]instead ofarr[seq]. In the future this will be interpreted as an array index,arr[np.array(seq)], which will result either in an error or a different result. vi = self.v[inds] ERROR groupy.gconv.chainer_gconv.test_gconv.test_p4m_net_equivariance ... ERROR groupy.gconv.chainer_gconv.test_gconv.test_g_z2_conv_equivariance ... ERROR groupy.gconv.chainer_gconv.test_gconv.test_p4_p4_conv_equivariance ... ERROR groupy.gconv.chainer_gconv.test_gconv.test_p4m_p4m_conv_equivariance ... ERROR groupy.gconv.chainer_gconv.test_transform_filter.test_transform_grad ... ERROR groupy.gfunc.test_gfuncarray.test_ot_func ... /home/ning_luo/GrouPy/groupy/garray/garray.py:144: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; usearr[tuple(seq)]instead ofarr[seq]. In the future this will be interpreted as an array index,arr[np.array(seq)]`, which will result either in an error or a different result. return self.factory(data=self.data[key], p=self.p) ok groupy.gfunc.test_gfuncarray.test_oht_func ... ok groupy.gfunc.test_gfuncarray.test_c4ht_func ... ok groupy.gfunc.test_gfuncarray.test_d4ht_func ... ok groupy.gfunc.test_gfuncarray.test_p4_func ... ok groupy.gfunc.test_gfuncarray.test_p4m_func ... ok groupy.gfunc.test_gfuncarray.test_z2_func ... ok groupy.gfunc.test_gfuncarray.test_z3_func ... ok

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_gconv.test_p4_net_equivariance

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 19, in test_p4_net_equivariance point_group=c4a, File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 112, in check_equivariance fmap = layer(fmap) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/splitgconv2d.py", line 155, in call tw = F.Reshape(tw_shape)(tw) AttributeError: 'module' object has no attribute 'Reshape'

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_gconv.test_p4m_net_equivariance

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 37, in test_p4m_net_equivariance point_group=d4a, File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 112, in check_equivariance fmap = layer(fmap) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/splitgconv2d.py", line 155, in call tw = F.Reshape(tw_shape)(tw) AttributeError: 'module' object has no attribute 'Reshape'

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_gconv.test_g_z2_conv_equivariance

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 54, in test_g_z2_conv_equivariance point_group=c4a, File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 112, in check_equivariance fmap = layer(fmap) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/splitgconv2d.py", line 155, in call tw = F.Reshape(tw_shape)(tw) AttributeError: 'module' object has no attribute 'Reshape'

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_gconv.test_p4_p4_conv_equivariance

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 77, in test_p4_p4_conv_equivariance point_group=c4a, File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 112, in check_equivariance fmap = layer(fmap) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/splitgconv2d.py", line 155, in call tw = F.Reshape(tw_shape)(tw) AttributeError: 'module' object has no attribute 'Reshape'

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_gconv.test_p4m_p4m_conv_equivariance

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 92, in test_p4m_p4m_conv_equivariance point_group=d4a, File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_gconv.py", line 112, in check_equivariance fmap = layer(fmap) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/splitgconv2d.py", line 155, in call tw = F.Reshape(tw_shape)(tw) AttributeError: 'module' object has no attribute 'Reshape'

====================================================================== ERROR: groupy.gconv.chainer_gconv.test_transform_filter.test_transform_grad

Traceback (most recent call last): File "/home/ning_luo/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_transform_filter.py", line 16, in test_transform_grad check_transform_c4_z2_grad(dtype, toll) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_transform_filter.py", line 25, in check_transform_c4_z2_grad check_transform_grad(inds, w, TransformGFilter, dtype, toll) File "/home/ning_luo/GrouPy/groupy/gconv/chainer_gconv/test_transform_filter.py", line 47, in check_transform_grad from chainer import gradient_check File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/gradient_check.py", line 11, in from chainer import testing File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/init.py", line 4, in from chainer.testing.distribution_test import distribution_unittest # NOQA File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/distribution_test.py", line 24, in class distribution_unittest(unittest.TestCase): File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/distribution_test.py", line 78, in distribution_unittest @skip_not_in_test_target('batch_shape') File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/attr.py", line 73, in gpu return multi_gpu(1)(f) File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/attr.py", line 55, in multi_gpu check_available() File "/home/ning_luo/.local/lib/python2.7/site-packages/chainer/testing/attr.py", line 21, in check_available Reason: {}: {}'''.format(name, type(_error).name, _error)) RuntimeError: chainer.testing.attr is not available.

Reason: ImportError: No module named pytest


Ran 29 tests in 28.538s

FAILED (errors=6)`