yobx.sklearn.skl2onnx_converter#

class yobx.sklearn.skl2onnx_converter.MockContainer(g: GraphBuilderExtendedProtocol)[source]#

Minimal mock for skl2onnx’s ModelComponentContainer.

Instead of accumulating nodes and initializers, this class delegates every add_node() / add_initializer() call directly to the GraphBuilder (g) that was provided at construction time.

add_initializer(name: str, onnx_type: int, shape: Tuple[int, ...], content: Any) None[source]#

Forward content directly to the GraphBuilder as a new initializer.

add_node(op_type: str, inputs: str | List[str], outputs: str | List[str], op_domain: str = '', op_version: int | None = None, name: str | None = None, **attrs: Any) None[source]#

Delegate a node directly to the GraphBuilder.

is_allowed(op_types: Set[str])[source]#

Tells if this operators are allowed.

property target_opset: int#

The main opset version, derived from the GraphBuilder.

property target_opset_all: Dict[str, int]#

Per-domain opset mapping, derived from the GraphBuilder.

class yobx.sklearn.skl2onnx_converter.MockOperator(raw_operator, inputs: List[MockVariable], outputs: List[MockVariable])[source]#

Minimal mock for skl2onnx’s Operator.

Holds the fitted sklearn estimator and the input / output MockVariable objects so a skl2onnx converter can read tensor names via operator.inputs[i].onnx_name and operator.output_full_names.

class yobx.sklearn.skl2onnx_converter.MockScope(g: GraphBuilderExtendedProtocol)[source]#

Minimal mock for skl2onnx’s Scope.

Provides get_unique_variable_name(), the only method called by typical skl2onnx converter functions. Name uniqueness is guaranteed by delegating to the GraphBuilder instance (g).

get_unique_operator_name(seed: str) str[source]#

Return a unique node name via the GraphBuilder.

get_unique_variable_name(seed: str) str[source]#

Return a unique result name via the GraphBuilder.

property target_opset: int#

The main opset version, derived from the GraphBuilder.

class yobx.sklearn.skl2onnx_converter.MockVariable(raw_name: str, onnx_name: str)[source]#

Minimal mock for skl2onnx’s Variable.

Stores the tensor name that will appear in emitted NodeProto inputs / outputs.

property full_name: str#

Alias for onnx_name (used by some skl2onnx converters).