[theano-users] function output cumsum() vs cumsum() function output

2018-10-03 Thread DL_user
Got another question that can't find guidelines from Theano document. 
Consider these two cases:

Case 1:
a = T.dmatrix('a')
b = T.dmatrix('b')
c = T.dmatrix('c')
y = T.pow(a,b)-c
f = theano.function([a,b,c], y)

f(np.reshape(np.ogrid[0:1:4j],(2,2)),np.reshape(np.ogrid[0:1:4j],(2,2)), 
np.reshape(np.ogrid[0:1:4j],(2,2))).cumsum()

Case 2:
a = T.dmatrix('a')
b = T.dmatrix('b')
c = T.dmatrix('c')
y = T.pow(a,b)-c
f = theano.function([a,b,c], y.cumsum())

f(np.reshape(np.ogrid[0:1:4j],(2,2)),np.reshape(np.ogrid[0:1:4j],(2,2)), 
np.reshape(np.ogrid[0:1:4j],(2,2)))

These two functions have the same output. So it seems theano.function() can 
take any (???) Python built-in operators like cumsum()? What else functions 
can be blended inside theano.function(), like ufunc or customized functions?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[theano-users] Theano dot function has different output than Numpy's

2018-10-02 Thread DL_user
Why do these two functions have different outputs, even both of them 
defined from numpy's dot() function:

x = T.dmatrix('x')

y = T.dvector('y')

z = np.dot(x,y)

f = theano.function([x,y],z)

f([[1,2,3],[4,5,6]],[7,8,9])
Out[31]: 
array([[ 7., 16., 27.],
   [28., 40., 54.]])

np.dot([[1,2,3],[4,5,6]],[7,8,9])
Out[32]: array([ 50, 122])

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[theano-users] Re: Theano dot function has different output than Numpy's

2018-10-02 Thread DL_user
I would think z=np.dot(x,y) is more meaningful but anyway apparently dot() 
has different meanings in Theano's world.

thanks

On Tuesday, October 2, 2018 at 3:59:14 PM UTC-7, Buruk Aregawi wrote:
>
> It seems that np.dot is interpreting this as the more standard A*x where A 
> is a 2x3 matrix and x is a 3 dimensional vector. Where as theano is 
> interpreting it is X*A where X is a 3x1 matrix and A is a 2x3 matrix.
> If you do 
> z = T.dot(x,y)
> instead of
> z = np.dot(x,y)
> they will both work the same and the theano function will interpret it as 
> the standard A*x.
>
> On Tuesday, October 2, 2018 at 5:55:10 PM UTC-4, DL_user wrote:
>>
>> Why do these two functions have different outputs, even both of them 
>> defined from numpy's dot() function:
>>
>> x = T.dmatrix('x')
>>
>> y = T.dvector('y')
>>
>> z = np.dot(x,y)
>>
>> f = theano.function([x,y],z)
>>
>> f([[1,2,3],[4,5,6]],[7,8,9])
>> Out[31]: 
>> array([[ 7., 16., 27.],
>>[28., 40., 54.]])
>>
>> np.dot([[1,2,3],[4,5,6]],[7,8,9])
>> Out[32]: array([ 50, 122])
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.