加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 在TensorFlow中计算Kronecker产品的最有效方法是什么

发布时间:2020-12-20 12:00:40 所属栏目:Python 来源:网络整理
导读:我有兴趣在TensorFlow中对Kronecker Recurrent Units实施 this paper. 这涉及Kronecker产品的计算. TensorFlow没有Kronecker产品的操作.我正在寻找一种有效而强大的计算方法. 这是否存在,还是需要手动定义TensorFlow操作? 解决方法 TensorFlow 1.7在tf.cont
我有兴趣在TensorFlow中对Kronecker Recurrent Units实施 this paper.

这涉及Kronecker产品的计算. TensorFlow没有Kronecker产品的操作.我正在寻找一种有效而强大的计算方法.

这是否存在,还是需要手动定义TensorFlow操作?

解决方法

TensorFlow 1.7在tf.contrib.kfac.utils.kronecker_product中提供了函数 kronecker_product

a = tf.eye(3)
b = tf.constant([[1.,2.],[3.,4.]])
kron = tf.contrib.kfac.utils.kronecker_product(a,b)

tf.Session().run(kron)

输出:

array([[1.,2.,0.,0.],4.,[0.,1.,3.,4.]],dtype=float32)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读