My question is, if you cast train_set_y, T.cast(train_set_y,'int32'),
doesn't it change its type from <TensorType(float64,vector)> to
<Elemwise{Cast{int32}}>? I think that's what I can't figure out.
Markus de Ruijter於 2017年3月27日星期一 UTC+8下午5時56分09秒寫道:
>
> You might have declared your variable as a float but are using it as an
> int.
>
> From the logistic regression example on
> http://deeplearning.net/tutorial/logreg.html#logreg :
>
> shared_y = theano.shared(numpy.asarray(data_y,
> dtype=theano.config.floatX),
> borrow=borrow)
> # When storing data on the GPU it has to be stored as floats
> # therefore we will store the labels as ``floatX`` as well
> # (``shared_y`` does exactly that). But during our computations
> # we need them as ints (we use labels as index, and if they are
> # floats it doesn't make sense) therefore instead of returning
> # ``shared_y`` we will have to cast it to int. This little hack
> # lets ous get around this issue
> return shared_x, T.cast(shared_y, 'int32')
>
> You can see they cast the "shared_y" variable to an integer:
> T.cast(shared_y, 'int32')
>
--
---
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.