yobx.tensorflow.ops.padding#
Converters for TF padding ops: Pad, PadV2, MirrorPad.
TensorFlow Pad / PadV2 store padding amounts as a 2-D tensor of shape
[N, 2] with layout [[begin0, end0], [begin1, end1], ...].
ONNX Pad (opset ≥ 11) expects a 1-D int64 tensor of shape [2N] with
layout [begin0, begin1, ..., beginN-1, end0, end1, ..., endN-1].
The converters transpose the TF paddings tensor from [N, 2] to [2, N]
and then flatten it to produce the ONNX-compatible layout.
- yobx.tensorflow.ops.padding.convert_mirror_pad(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
Converts TF
MirrorPad→ ONNXPadwithmodeattribute.TF
modeattribute values:"REFLECT"→ ONNXmode="reflect"(excludes the border value)"SYMMETRIC"→ ONNXmode="edge"(includes the border value)
- yobx.tensorflow.ops.padding.convert_pad(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
Converts TF
Pad/PadV2→ ONNXPad.PadV2carries an explicitconstant_valuesinput (third input) which is forwarded to the ONNXPadnode as the optional constant value.Padpads with zeros and does not need that input.