python - tensorflow einsum 跟踪错误?
问题描述
为什么这些输出不同?这是预期的行为吗?我正在使用张量流 1.12
import tensorflow as tf
matrix = tf.constant([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
with tf.Session() as sess:
print(tf.einsum('ii',matrix).eval())
# 45
尽管
import numpy as np
np.einsum('ii',[[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
# 15 (as it should be)
为什么 tensorflow 的 einsum 对矩阵的所有元素求和?
更新:我在 GitHub 上打开了一个问题,它看起来像一个错误。
解决方案
这已在 PR 25079 中修复并合并。
推荐阅读
- discord - Discord Get Guild 没有返回对象
- google-cloud-platform - 将 ssh 连接到 GCP 的计算引擎时出现问题
- java - Spring boot + Amazon DocDB + Cert CA Bundle 出现错误 io.netty.handler.ssl.sslclosedengineexception:SSLEngine 已关闭
- dataframe - 将数据框中的行更改为因子
- typescript - 模块解析失败:意外字符 '�' (1:0) NEXTJS NESTJS
- python - 如何同时捕获 OSError 和 FileNotFoundError
- apache-kafka - 如何使用 kafka-python 检测分区结束?
- angularjs - $q.all() - 不按顺序返回的响应
- javascript - 按顺序运行多个 Promise.all() (只有在第一个完成后才读取第二个 Promise.all)
- react-native - 从 github 编译应用程序的本机反应