'theano.tensor.cast'返回的变量类型

时间:2016-03-02 12:46:48

标签: python theano

当输入是共享变量时,theano.tensor.cast返回的变量的确切类型是什么?

例如,执行以下代码:

import theano.tensor as T
from theano import function, shared
import numpy as np

x = shared(np.array([1.1, 2.2, 3.3, 4.4, 5.5], dtype = np.float64))
y = T.cast(x, 'int32')
print type(x)     # <class 'theano.tensor.sharedvar.TensorSharedVariable'>
print type(y)     # <class 'theano.tensor.var.TensorVariable'>

'''
however, the variable y has value like "shared variable"
'''

f = function([], y[:3])
print f()            # it shows ''[1 2 3]''

那么......变量y的类型是什么?

0 个答案:

没有答案