tf.eye

tf.eye(2)
<tf.Tensor: shape=(2, 2), dtype=float32, numpy=
array([[1., 0.],
       [0., 1.]], dtype=float32)>
tf.eye(2, batch_shape=[3])
<tf.Tensor: shape=(3, 2, 2), dtype=float32, numpy=
array([[[1., 0.],
        [0., 1.]],

       [[1., 0.],
        [0., 1.]],

       [[1., 0.],
        [0., 1.]]], dtype=float32)>
tf.eye(2, num_columns=3)
<tf.Tensor: shape=(2, 3), dtype=float32, numpy=
array([[1., 0., 0.],
       [0., 1., 0.]], dtype=float32)>
posted @ 2022-08-19 22:51  luoganttcc  阅读(16)  评论(0)    收藏  举报