Skip to content Skip to sidebar Skip to footer

Convert Python Ndarray To Theano Tensor Type Variable

I have ndarray like : diag = [] diag.append(np.diag([1,1,0])) diag.append(np.diag([0,1,1])) diag [array([[1, 0, 0], [0, 1, 0], [0, 0, 0]]), array([[0, 0, 0], [0, 1, 0],

Solution 1:

Just create a SharedVariable like this

diag_ = theano.shared(np.array(diag).astype("float64"))
theano.dot(diag_, X)

http://deeplearning.net/software/theano/library/compile/shared.html

Post a Comment for "Convert Python Ndarray To Theano Tensor Type Variable"