1. 程式人生 > >theano T.dot 例項 (是tf.matmul而不是點乘)

theano T.dot 例項 (是tf.matmul而不是點乘)

import theano
import numpy as np
import theano.tensor as T
ones = theano.shared(np.float32([[1,2,3],[4,5,6],[7,8,9]]))

print(ones.get_value())

result = T.dot(ones,ones)

print(result.eval())

結果:

[[ 1. 2. 3.]
[ 4. 5. 6.]
[ 7. 8. 9.]]

[[ 30. 36. 42.]
[ 66. 81. 96.]
[ 102. 126. 150.]]