我知道np.eye
,它生成单位矩阵。我是说单位矩阵是
In linear algebra, the identity matrix, or sometimes ambiguously called a
unit matrix
, of size n is then × n
square matrix with ones on the main diagonal and zeros elsewhere.
我知道我们可以在Numpy
中用np.identity(3)
创建它。在
But, I would like to know how can I have an identity Tensor in python.
我想在张量乘法中使用单位张量。如下所示:
其中G = Er ×1 U1 ×2 U2 ...×M
UM
是变换张量,Er ∈
R
r×r×...×r
是一个恒等张量(对角线元素是1,所有其他条目都是0)。我需要生成identity tensor
的代码。在
提前谢谢你。在
使用
np.identity
代替tf.eye
:像这样?在
测试
^{pr2}$相关问题 更多 >
编程相关推荐