TensorFlow2 一小时学会基本操作 4
张量排序
tf.sort
tf.sort函数可以帮我们对张量进行排序....k 个最大条目的值和索引....dtype=int32, numpy=
array([[2, 0],
[1, 0],
[0, 1]])>)
填充与复制
tf.pad
tf.pad可以帮我们对一个...]
[0. 1. 1.]], shape=(3, 3), dtype=float32)
tf.scatter_nd
使用索引更新张量....格式:
tf.scatter_nd(
indices, updates, shape, name=None
)
参数:
indices: 索引- updates: 更新的值- shape: