yobx.tensorflow.ops.const#
Converters for TF ops that act as pass-throughs or supply constant values:
ReadVariableOp, Const, Identity, and NoOp.
- yobx.tensorflow.ops.const.convert_const(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
Materialises a TF
Constop as a numpy array in the context.The constant value is extracted from the op’s
"value"attribute and converted to a numpy array. It will be embedded as an ONNX initializer when first consumed by a downstream op.
- yobx.tensorflow.ops.const.convert_identity(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
Propagates the input tensor name / value without emitting any ONNX node.
Identityis used heavily as a graph-internal pass-through (e.g. to attach a name to an output). We simply forward whatever value or ONNX name the input has to the output, so downstream converters can use it directly.
- yobx.tensorflow.ops.const.convert_noop(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
NoOp— nothing to emit.
- yobx.tensorflow.ops.const.convert_read_variable_op(g: GraphBuilderExtendedProtocol, sts: Dict[str, Any], outputs: List[str], op: Operation) str[source]#
Propagates a captured-variable value to the op’s output tensor.
In TF’s graph, variables are captured as resource handles. A
ReadVariableOpreads the current value from such a handle. Because we have already seededstswith the numpy values of all captured variables, this converter simply maps the op’s output tensor name to the same numpy array that was stored under the input (handle) tensor name.