yobx.xshape._builder_runtime#
- class yobx.xshape._builder_runtime._BuilderRuntime[source]#
Computes the output of a couple of nodes knowing their inputs. It supports numpy and torch tensors. Most of the function are used while exporting a model, by
_InferenceRuntime.compute_constant.- _apply_expand_to_shape(input_shape: Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...], new_shape: Tuple[int, ...]) Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...][source]#
Returns the shape of the output of a node Reshape.
- _apply_reshape_to_shape(input_shape: Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...], new_shape: Tuple[int, ...]) Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...][source]#
Returns the shape of the output of a node Reshape.
- make_torch_tensor_from_np_array(arr: ndarray) torch.Tensor[source]#
Converts a numpy array to a torch tensor.
- onnx_dtype_to_torch_dtype(itype: int) torch.dtype[source]#