W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
eye(
num_rows,
num_columns=None,
batch_shape=None,
dtype=tf.float32,
name=None
)
定義在:tensorflow/python/ops/linalg_ops.py.
參考指南:數(shù)學(xué)函數(shù)>矩陣數(shù)學(xué)函數(shù)
利用上述函數(shù)就可以在 TensorFlow 中構(gòu)造一個(gè)單位矩陣.
# Construct one identity matrix.
tf.eye(2)
==> [[1., 0.],
[0., 1.]]
# Construct a batch of 3 identity matricies, each 2 x 2.
# batch_identity[i, :, :] is a 2 x 2 identity matrix, i = 0, 1, 2.
batch_identity = tf.eye(2, batch_shape=[3])
# Construct one 2 x 3 "identity" matrix
tf.eye(2, num_columns=3)
==> [[ 1., 0., 0.],
[ 0., 1., 0.]]
形狀為 batch_shape + [num_rows, num_columns] 的張量.
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: