Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

fail to import tangent #99

Closed
JiafengYang opened this issue Dec 29, 2019 · 3 comments
Closed

fail to import tangent #99

JiafengYang opened this issue Dec 29, 2019 · 3 comments

Comments

@JiafengYang
Copy link

I have inatalled the tangent, but there is a problem when I import it
Here is a simple example:
import tangent

The error shows that :
File "/anaconda3/lib/python3.7/site-packages/tangent/utils.py", line 229, in register_shape_function
assert t not in shape_functions
AssertionError

Thanks in advance !

@mdanatg
Copy link

mdanatg commented Jan 6, 2020

This is probably due to some change in one of the underlying platforms. Tangent is not being actively maintained any more, but it should be fairly straightforward to fix this by changing shape_functions from a dict of type to callable to a dict of type to tuple of callables. It should only be used in a small number of places like unreduce_like.

@Sijie-L
Copy link

Sijie-L commented Apr 24, 2020

This is probably due to some change in one of the underlying platforms. Tangent is not being actively maintained any more, but it should be fairly straightforward to fix this by changing shape_funcrtions from a dict of type to callable to a dict of type to tuple of callables. It should only be used in a small number of places like unreduce_like.

Could you please specify the exact code to add? I encounter this same problem while importing tangent after using the code in #95 .

@mdanatg
Copy link

mdanatg commented Apr 25, 2020

Sorry, it's been a while, and I don't remember why I suggested that. Have a look at https://github.com/google/tangent/blob/master/tangent/utils.py - the assertion failure suggests register_shape_function is called repeatedly with the same type, and it shouldn't. It would be useful to understand why it gets called repeatedly, and if doing that is fine, just remove the assertion.

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

No branches or pull requests

3 participants