填充张量。
用法
tf.raw_ops.PadV2(
input, paddings, constant_values, name=None
)参数
-
input一个Tensor。 -
paddings一个Tensor。必须是以下类型之一:int32,int64。 -
constant_values一个Tensor。必须与input具有相同的类型。 -
name操作的名称(可选)。
返回
-
一个
Tensor。具有与input相同的类型。
此操作根据您指定的paddings 和constant_values 填充input。 paddings 是形状为 [Dn, 2] 的整数张量,其中 n 是 input 的秩。对于每个维度,input , paddings[D, 0]的D表示该维度中input的内容之前要添加多少个填充值,paddings[D, 1]表示该维度中input的内容之后要添加多少个填充值。 constant_values 是与 input 类型相同的标量张量,指示用于填充 input 的值。
输出的每个维度 D 的填充大小为:
paddings(D, 0) + input.dim_size(D) + paddings(D, 1)
例如:
# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# 'constant_values' is 0
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
[0, 0, 1, 1, 0, 0]
[0, 0, 2, 2, 0, 0]
[0, 0, 0, 0, 0, 0]]
相关用法
- Python tf.raw_ops.Pad用法及代码示例
- Python tf.raw_ops.ParallelConcat用法及代码示例
- Python tf.raw_ops.ParseSequenceExampleV2用法及代码示例
- Python tf.raw_ops.ParallelDynamicStitch用法及代码示例
- Python tf.raw_ops.Pack用法及代码示例
- Python tf.raw_ops.Pow用法及代码示例
- Python tf.raw_ops.TPUReplicatedInput用法及代码示例
- Python tf.raw_ops.Bitcast用法及代码示例
- Python tf.raw_ops.SelfAdjointEigV2用法及代码示例
- Python tf.raw_ops.BatchMatMul用法及代码示例
- Python tf.raw_ops.OneHot用法及代码示例
- Python tf.raw_ops.ResourceScatterNdSub用法及代码示例
- Python tf.raw_ops.ReadVariableXlaSplitND用法及代码示例
- Python tf.raw_ops.GatherV2用法及代码示例
- Python tf.raw_ops.Expm1用法及代码示例
- Python tf.raw_ops.BitwiseAnd用法及代码示例
- Python tf.raw_ops.UniqueWithCounts用法及代码示例
- Python tf.raw_ops.DecodeGif用法及代码示例
- Python tf.raw_ops.Size用法及代码示例
- Python tf.raw_ops.ScatterUpdate用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.raw_ops.PadV2。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
