jacobgil / pytorch-tensor-decompositions

PyTorch implementation of [1412.6553] and [1511.06530] tensor decomposition methods for convolutional layers.
https://jacobgil.github.io/deeplearning/tensor-decompositions-deep-learning
280 stars 63 forks source link

This does not work in pytorch 1.6.0 version. #9

Open JoonHong-Kim opened 2 years ago

JoonHong-Kim commented 2 years ago
Traceback (most recent call last):
  File "main.py", line 112, in <module>
    tl.set_backend('pytorch')
  File "/opt/conda/lib/python3.8/site-packages/tensorly/backend/__init__.py", line 213, in set_backend
    backend = cls.load_backend(backend)
  File "/opt/conda/lib/python3.8/site-packages/tensorly/backend/__init__.py", line 191, in load_backend
    importlib.import_module('tensorly.backend.{0}_backend'.format(backend_name))
  File "/opt/conda/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/conda/lib/python3.8/site-packages/tensorly/backend/pytorch_backend.py", line 230, in <module>
    PyTorchBackend.register_method(name, getattr(torch, name))
AttributeError: module 'torch' has no attribute 'count_nonzero'

This error occurs because the pytorch 1.6.0 version does not provide count_nonzero. This is because it is a function that starts from 1.7.0 version. So I suggest that you have requirements.txt in your repository.