反轉張量的特定維度。
用法
tf.raw_ops.ReverseV2(
tensor, axis, name=None
)參數
-
tensor一個Tensor。必須是以下類型之一:uint8,int8,uint16,int16,int32,uint32,int64,uint64,bool,bfloat16,half,float32,float64,complex64,complex128,string。高達 8 維。 -
axis一個Tensor。必須是以下類型之一:int32,int64。一維。要反轉的維度的索引。必須在[-rank(tensor), rank(tensor))範圍內。 -
name操作的名稱(可選)。
返回
-
一個
Tensor。具有與tensor相同的類型。
給定一個 tensor 和一個 int32 張量 axis 表示要反轉的 tensor 的維度集。此操作反轉每個存在 j s.t. 的維度 i。 axis[j] == i 。
tensor 最多可以有 8 個維度。 axis 中指定的維數可以是 0 個或多個條目。如果多次指定索引,則會引發 InvalidArgument 錯誤。
例如:
# tensor 't' is [[[[ 0, 1, 2, 3],
# [ 4, 5, 6, 7],
# [ 8, 9, 10, 11]],
# [[12, 13, 14, 15],
# [16, 17, 18, 19],
# [20, 21, 22, 23]]]]
# tensor 't' shape is [1, 2, 3, 4]
# 'dims' is [3] or 'dims' is [-1]
reverse(t, dims) ==> [[[[ 3, 2, 1, 0],
[ 7, 6, 5, 4],
[ 11, 10, 9, 8]],
[[15, 14, 13, 12],
[19, 18, 17, 16],
[23, 22, 21, 20]]]]
# 'dims' is '[1]' (or 'dims' is '[-3]')
reverse(t, dims) ==> [[[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]
[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]]]]
# 'dims' is '[2]' (or 'dims' is '[-2]')
reverse(t, dims) ==> [[[[8, 9, 10, 11],
[4, 5, 6, 7],
[0, 1, 2, 3]]
[[20, 21, 22, 23],
[16, 17, 18, 19],
[12, 13, 14, 15]]]]
相關用法
- Python tf.raw_ops.Reverse用法及代碼示例
- Python tf.raw_ops.ReverseSequence用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代碼示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代碼示例
- Python tf.raw_ops.ResourceScatterMul用法及代碼示例
- Python tf.raw_ops.ReduceJoin用法及代碼示例
- Python tf.raw_ops.ResourceScatterAdd用法及代碼示例
- Python tf.raw_ops.ResourceScatterMax用法及代碼示例
- Python tf.raw_ops.ResourceScatterMin用法及代碼示例
- Python tf.raw_ops.Real用法及代碼示例
- Python tf.raw_ops.Relu用法及代碼示例
- Python tf.raw_ops.ResourceGather用法及代碼示例
- Python tf.raw_ops.Reshape用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdAdd用法及代碼示例
- Python tf.raw_ops.ResourceScatterNdUpdate用法及代碼示例
- Python tf.raw_ops.ResourceScatterSub用法及代碼示例
- Python tf.raw_ops.ResourceScatterUpdate用法及代碼示例
- Python tf.raw_ops.ResourceScatterDiv用法及代碼示例
- Python tf.raw_ops.RegexFullMatch用法及代碼示例
- Python tf.raw_ops.RaggedGather用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.raw_ops.ReverseV2。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
