yobx.xshape._inference_runtime¶
- class yobx.xshape._inference_runtime._InferenceRuntime[source][source]¶
Sets shape and type.
- class ShapeConstant(name: str, shape: Tuple[int, ...], node: NodeProto)[source][source]¶
Wraps a constant shape even if the input producing the shape is not.
- _get_tensor_shape(node: NodeProto) Tuple[int, ...][source][source]¶
Returns the shape of the tensor produced by a Constant node.
- _get_tensor_type(node: NodeProto) int[source][source]¶
Returns the element type of the tensor produced by a Constant node.
- _make_node_set_type_shape(node: NodeProto, exc: bool = False)[source][source]¶
Updates shapes for a node.
- compute_constant(name: str, exc: bool = True, only_array: bool = False, allow_empty: bool = False) Tuple[ndarray, Dict[str, ndarray] | None][source][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.