tensorflow einsum的跟踪错误



为什么这些输出不同?这是故意的行为吗?我使用的是tensorflow 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上打开了一个问题,它看起来像一个bug。

这是在PR 25079中修复并合并的。

最新更新