沿轴滚动张量的元素。
用法
tf.raw_ops.Roll(
input, shift, axis, name=None
)
参数
-
input
一个Tensor
。 -
shift
一个Tensor
。必须是以下类型之一:int32
,int64
。维度必须是 0-D 或 1-D。shift[i]
指定元素沿axis[i]
指定的维度正向(朝向更大的索引)移动的位置数。负位移将沿相反方向滚动元素。 -
axis
一个Tensor
。必须是以下类型之一:int32
,int64
。维度必须是 0-D 或 1-D。axis[i]
指定移位shift[i]
应该发生的维度。如果多次引用同一轴,则该轴的总位移将是属于该轴的所有位移的总和。 -
name
操作的名称(可选)。
返回
-
一个
Tensor
。具有与input
相同的类型。
元素沿 axis
的维度通过 shift
的偏移量正向移动(朝向更大的索引)。负的shift
值将沿相反方向移动元素。滚动通过最后一个位置的元素将环绕到第一个位置,反之亦然。可以指定沿多个轴的多个移位。
例如:
# 't' is [0, 1, 2, 3, 4]
roll(t, shift=2, axis=0) ==> [3, 4, 0, 1, 2]
# shifting along multiple dimensions
# 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
roll(t, shift=[1, -2], axis=[0, 1]) ==> [[7, 8, 9, 5, 6], [2, 3, 4, 0, 1]]
# shifting along the same axis multiple times
# 't' is [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
roll(t, shift=[2, -3], axis=[1, 1]) ==> [[1, 2, 3, 4, 0], [6, 7, 8, 9, 5]]
相关用法
- Python tf.raw_ops.ResourceScatterNdSub用法及代码示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代码示例
- Python tf.raw_ops.ResourceScatterMul用法及代码示例
- Python tf.raw_ops.RaggedGather用法及代码示例
- Python tf.raw_ops.ReduceJoin用法及代码示例
- Python tf.raw_ops.RGBToHSV用法及代码示例
- Python tf.raw_ops.Range用法及代码示例
- Python tf.raw_ops.RaggedCross用法及代码示例
- Python tf.raw_ops.ResourceScatterAdd用法及代码示例
- Python tf.raw_ops.ResourceScatterMax用法及代码示例
- Python tf.raw_ops.ResourceScatterMin用法及代码示例
- Python tf.raw_ops.RandomShuffle用法及代码示例
- Python tf.raw_ops.Real用法及代码示例
- Python tf.raw_ops.RaggedRange用法及代码示例
- Python tf.raw_ops.Rint用法及代码示例
- Python tf.raw_ops.Relu用法及代码示例
- Python tf.raw_ops.ReverseV2用法及代码示例
- Python tf.raw_ops.ResourceGather用法及代码示例
- Python tf.raw_ops.Reverse用法及代码示例
- Python tf.raw_ops.Reshape用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.Roll。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。