minpy icon indicating copy to clipboard operation
minpy copied to clipboard

second grad error

Open kernel8liang opened this issue 8 years ago • 5 comments

Run autograd_tutorial example,

https://github.com/dmlc/minpy/blob/master/examples/tutorials/autograd_tutorial.ipynb

import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'

x = np.linspace(-10, 10, 200)
# plt.plot only takes ndarray as input. Explicitly convert MinPy Array into ndarray.
plt.plot(x.asnumpy(), foo(x).asnumpy(),
         x.asnumpy(), d_foo(x).asnumpy(),
         x.asnumpy(), d_2_foo(x).asnumpy(),
         x.asnumpy(), d_3_foo(x).asnumpy())
plt.show()

error below

AttributeError                            Traceback (most recent call last)
<ipython-input-5-317bda464833> in <module>()
      9 plt.plot(x.asnumpy(), foo(x).asnumpy(),
     10          x.asnumpy(), d_foo(x).asnumpy(),
---> 11          x.asnumpy(), d_2_foo(x).asnumpy(),
     12          x.asnumpy(), d_3_foo(x).asnumpy())
     13 plt.show()

AttributeError: 'float' object has no attribute 'asnumpy'
In [2]: mxnet.__version__
Out[2]: '0.9.4'

minpy version 0.33.

kernel8liang avatar Mar 24 '17 06:03 kernel8liang

Related to #155, any fixes on this?

wangg12 avatar Mar 24 '17 06:03 wangg12

I will try to make a temporary solution in the weekend. In long term this part will be replaced by MXNet's NDArray subsystem which we are working on now.

lryta avatar Mar 24 '17 18:03 lryta

We should still fix this. It is a quite important feature.

On Fri, Mar 24, 2017 at 2:40 PM, Larry Tang [email protected] wrote:

I will try to make a temporary solution in the weekend. In long term this part will be replaced by MXNet's NDArray subsystem which we are working on now.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dmlc/minpy/issues/165#issuecomment-289110532, or mute the thread https://github.com/notifications/unsubscribe-auth/AD3qZWpgP4ne5oKfcXxhQUZcIp1TPErgks5rpA4wgaJpZM4MnwQf .

-- Minjie Wang New York University | Computer Science 715 Broadway, New York, NY, 10009

jermainewang avatar Mar 24 '17 19:03 jermainewang

@jermainewang I found the reason now. Look at here: link. The function pushed into gradient record is unwrapped version. Which means that tape cannot record operations there. I think this change is due to performance concern. Should we fix it or wait autograd runtime? (By the way, does autograd runtime support higher order derivatives?

lryta avatar Mar 26 '17 05:03 lryta

@lryta Do we have any follow-up on this?

Taco-W avatar May 31 '17 22:05 Taco-W