parrt / tensor-sensor

The goal of this library is to generate more helpful exception messages for matrix algebra expressions for numpy, pytorch, jax, tensorflow, keras, fastai.
https://github.com/parrt/tensor-sensor
MIT License
771 stars 39 forks source link

Remove hard torch dependecies for keras/tensorflow user #9

Closed noklam closed 3 years ago

noklam commented 3 years ago

Currently, in the analysis.py _shape method it always try to check if torch.Size exist. So for a keras user, if they don't have torch install, it will throw an error since analysis.py is importing it.

  File "/home/shawley/Downloads/tensor-sensor/tsensor/analysis.py", line 27, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

Related #8

drscotthawley commented 3 years ago

Or even just for numpy users! The first example in the documentation is only using numpy, not Keras/tensorflow.

noklam commented 3 years ago

I think this automatically works for NumPy too. Since only torch is imported explicitly

parrt commented 3 years ago

Fixed by https://github.com/parrt/tensor-sensor/pull/10

parrt commented 3 years ago

@drscotthawley please try now. thanks! pip install -U tensor-sensor

drscotthawley commented 3 years ago

@parrt Works! Lovely! Even outside of Jupyter. When I run from the shell a little matplotlib-style window pops up showing the image. Thanks!