joschu / cgt

Computation Graph Toolkit
Other
628 stars 87 forks source link

Support for square root operation on Node #62

Closed Sentient07 closed 8 years ago

Sentient07 commented 8 years ago

I was trying out this code for profiling cgt and theano for understanding how better the graph optimisations are done in CGT. x = cgt.scalar(name='x', dtype='float32') y = cgt.scalar(name='y', dtype='float32') func = np.sqrt((x**2)*(y/x)*(x**3/y**3) -(x**2)*(y/x)*(x**3/y**3) + (x**2)*(y/x)*(x**3/y**3)) and then i got this error while compiling the function, AttributeError: 'Node' object has no attribute 'sqrt' Would be glad to have square root support Thanks

nouiz commented 8 years ago

If you cann cgt.sqrt (or similar) instead of numpy np.sqrt(), does it work?

On Sun, Mar 20, 2016 at 12:21 PM, Ramana Subramanyam < notifications@github.com> wrote:

I was trying out this code for profiling cgt and theano for understanding how better the graph optimisations are done in CGT. x = cgt.scalar(name='x', dtype='float32') y = cgt.scalar(name='y', dtype='float32') func = np.sqrt((x2)(y/x)(x3/y3) -(x2)(y/x)(x3/y3) + (x2)(y/x)(x3/y**3))

and then i got this error while compiling the function, AttributeError: 'Node' object has no attribute 'sqrt'

Would be glad to have square root support Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/joschu/cgt/issues/62

joschu commented 8 years ago

Yes, cgt.sqrt will work.