On Wednesday, May 28, 2014 at 1:48:19 PM UTC+3, Zay Maung Maung Aye wrote:
>
> Hi,
>
> I have computed a theano tensor matrix and I would like to get the
> bincount in *each row *of the tensor variable. So I think I'll need
> either some types of looping on TensorVariable or getting the values from
> TensorVariable into numpy.array.
>
> I am using the theano.scan to loop through each row of the matrix and it
> works when I entered *numeric values* to the theano function *predict*.
> But my input matrix is a TensorVariable computed from earlier steps and
> theano.function does not accept TensorVariable. Is there any way to work
> around this problem? Can I extract the values from TheanoVariable as
> numpy.array? or is there any way to work directly on the TensorVariable?
>
>
> X = T.imatrix('X')
> results, updates = theano.scan(lambda x_i:
> T.argmax(T.extra_ops.bincount(x_i)), sequences=[X])
> predict = theano.function(inputs=[X], outputs=[results])
>
> predict(Y)
>
> Y is a TensorVariable from another function.
>
> And the error that I face is:
>
> File "/usr/local/lib/python2.7/dist-packages/theano/tensor/type.py",
> line 66, in filter
> 'Expected an array-like object, but found a Variable: '
> TypeError: ('Bad input argument to theano function at index 0(0-based)',
> 'Expected an array-like object, but found a Variable: maybe you are trying
> to call a function on a (possibly shared) variable instead of a numeric
> array?')
>
> I'm new to theano and I don't know how people approach this type of
> problems. Please help.
>
> Thanks.
>
--
---
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.