renmengye / tensorflow-forward-ad

Forward-mode Automatic Differentiation for TensorFlow
MIT License
139 stars 18 forks source link

Relative imports? #4

Closed jiamings closed 7 years ago

jiamings commented 7 years ago

Hi Mengye,

Nice repo for implementing forward mode diff! I find it to be very useful :) However, when I am installing using pip, running the code directly reports the error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tony/.anaconda3/envs/openai/lib/python3.5/site-packages/tensorflow_forward_ad/__init__.py", line 1, in <module>
    from fwgrad import forward_gradients
ImportError: No module named 'fwgrad'

As you can see I am using Python 3.5 (Anaconda).

I think this should be solved if you modify 3 lines of code to support relative import in the package source files. Will add a PR soon.

renmengye commented 7 years ago

Hi, thank you for raising up the issue. I fixed the import statements in my latest commit.

jiamings commented 7 years ago

Cool, thanks!