yobx.xshape._inference_runtime#

class yobx.xshape._inference_runtime._InferenceRuntime[source]#

Sets shape and type.

class ShapeConstant(name: str, shape: Tuple[int, ...], node: NodeProto)[source]#

Wraps a constant shape even if the input producing the shape is not.

_make_node_set_type_shape(node: NodeProto, exc: bool = False)[source]#

Updates shapes for a node.

compute_constant(name: str, exc: bool = True, only_array: bool = False, allow_empty: bool = False) Tuple[ndarray | None, Dict[str, ndarray] | None][source]#

Computes a constant.

Parameters:
  • name – constant name

  • exc – raises an exception if any failure

  • only_array – do not return TensorProto

  • allow_empty – allow empty result

Returns:

constant

If returns None if the constant is a FakeTensor.

make_dimension_name_if_necessary(a: int | str, b: int | str, op: str) str[source]#

Creates a new dimension.

update_node_constant(name: str, node: NodeProto) bool[source]#

Updates a constant NodeProto.

class yobx.xshape._inference_runtime._OptimizationOptions[source]#

Default optimization options for BasicShapeBuilder.