I have a matrix and 3D tensor defined as below :

      
    import numpy as np
    import theano
    import theano.tensor as T

    a = T.matrix('a', dtype='float32')
    c = T.tensor3('c',dtype='float32')
    d = T.batched_dot(c, a)
    g = theano.function([a,c],d)
    Y = [[[1, 0, 0, 0],  [0, 1, 0, 0],  [0, 0, 1, 0], [0, 0, 0, 0]], [[0, 0 
,0, 0], [0, 1, 0, 0],[0, 0, 1, 0],[0, 0, 0, 1]]]
    X = [[ 0.5052417 ,  0.22012063,  0.21787818,  0.41821062, 1, 1, 1, 0], [ 
0.48668074,  0.26137591,  0.240702  ,  0.41308364, 0, 1, 1, 1]]
    x = np.array(X, dtype='float32')
    y = np.array(Y, dtype='float32')
    print g(x[:,0:4], y)


Although it gives correct answer in the end, but in the middle it shows 
many error as 

    
ValueError: get_scalar_constant_value detected deterministic IndexError: x.
shape[2] when x.ndim=2. x=Subtensor{int64}.0
    ERROR (theano.gof.opt): Optimization failure due to: 
local_gpua_gemmbatch
    ERROR (theano.gof.opt): node: BatchedDot(c, a)
    ERROR (theano.gof.opt): TRACEBACK:
    ValueError: get_scalar_constant_value detected deterministic IndexError: 
x.shape[2] when x.ndim=2. x=Subtensor{int64}.0



 My expected output is 

    [[ 0.50524169  0.22012062  0.21787818  0.        ]
    [ 0.          0.2613759   0.240702    0.41308364]]

And I am getting that output as well in the end.

How can I correctly multiply those two, without any errors ?

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to