theano T.col 实例

网友投稿 232 2022-09-21

theano T.col 实例

import theanoimport numpy as npimport theano.tensor as Tnumbers = theano.shared(np.float32([[1,2,3],[4,5,6],[7,8,9]]))numbers2 = T.col("temp_col",'float32')temp = numbers+numbers2train = theano.function(inputs=[numbers2],outputs=temp)print(train(np.float32([[1],[2],[3]])))

print结果: [[ 2. 3. 4.] [ 6. 7. 8.] [ 10. 11. 12.]]

import theanoimport numpy as npimport theano.tensor as Tnumbers = theano.shared(np.float32([[1,2,3],[4,5,6],[7,8,9]]))numbers2 = T.col("temp_col",'float32')temp = numbers*numbers2train = theano.function(inputs=[numbers2],outputs=temp)print(train(np.float32([[1],[2],[3]])))

print结果: [[ 1. 2. 3.] [ 8. 10. 12.] [ 21. 24. 27.]]

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:公关界007:时代里的每个奋斗者都值得被歌颂,平安普惠《每一道微光》背后的品牌力量!
下一篇:theano scan 实例
相关文章

 发表评论

暂时没有评论,来抢沙发吧~