Hi,
Types other than regular tensors (with fixed shape along each dimension)
are not supported in scan.
Moreover, the input and output values of the step function of scan must
always have the same shapes across iterations.
Common workarounds include padding and keeping a mask, or a list of lengths.
On Sun, Dec 11, 2016, 马凯 wrote:
>
>
> I have a list :
>
> my_list = [[1,2,3,4], [4,5,6], [1,2,1,2,1,2]]
>
>
> I also have a tensor variable:
>
> a_tensor = theano.tensor.ivector("tensor")
>
>
> now I want to use theano.scan to get the corresponding item in the list
> given the index:
>
> result, _ = theano.scan(fn=lambda idx, a_list:a_list[idx],
> sequences=[a_tensor],
> non_sequences=theano.shared(np.array(my_list)))
>
>
> but got the error: *TypeError: The generic 'SharedVariable' object is not
> subscriptable. This shared variable contains a Numpy array with dtype:
> 'object'. This data type is not currently recognized by Theano tensors:
> please cast your data into a supported numeric type if you need Theano
> tensor functionalities. *
>
>
> I'm very new to Theano so I'm probably thinking about this problem in the
> wrong way. I would really appreciate any advice.
>
> --
>
> ---
> 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.
--
Pascal
--
---
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.