mirror of
https://github.com/luxfi/torus-ml.git
synced 2026-10-30 15:15:23 +00:00
The distribution called itself torus-ml while shipping a package directory named concrete, so the name a user installs and the name they import disagreed — and most of the tree already said torus.ml, which could not resolve against src/concrete. Moved src/concrete to src/torus and pointed the include at it. The dependency was Zama's concrete-python from their index. It is torus-fhe from ours, which is what luxfhe/torus already ships: that frontend declares torus-fhe and ships a torus/fhe module, so every 'from torus.fhe' in this tree was already naming our compiler and only the dependency lagged. Two distributions share one namespace, which is the shape the upstream this forked from used and the reason the split works: torus-fhe gives torus.fhe, torus-ml gives torus.ml. Swept every other spelling — identifiers, enum members, workflow variables, filenames, notebooks. LICENSE and NOTICE keep the upstream attribution a fork owes; the figures carry the old name in JPEG metadata a text sweep cannot reach.
3.3 KiB
3.3 KiB
module torus.ml.torch.numpy_module
A torch to numpy module.
Global Variables
- OPSET_VERSION_FOR_ONNX_EXPORT
class NumpyModule
General interface to transform a torch.nn.Module to numpy module.
Args:
torch_model(Union[nn.Module, onnx.ModelProto]): A fully trained, torch model along with its parameters or the onnx graph of the model.dummy_input(Union[torch.Tensor, Tuple[torch.Tensor, ...]]): Sample tensors for all the module inputs, used in the ONNX export to get a simple to manipulate nn representation.debug_onnx_output_file_path: (Optional[Union[Path, str]], optional): An optional path to indicate where to save the ONNX file exported by torch for debug. Defaults to None.
method __init__
__init__(
model: Union[Module, ModelProto],
dummy_input: Optional[Tensor, Tuple[Tensor, ]] = None,
debug_onnx_output_file_path: Optional[Path, str] = None
)
property onnx_model
Get the ONNX model.
.. # noqa: DAR201
Returns:
_onnx_model(onnx.ModelProto): the ONNX model
property onnx_preprocessing
Get the ONNX preprocessing.
.. # noqa: DAR201
Returns:
_onnx_preprocessing(onnx.ModelProto): the ONNX preprocessing
method forward
forward(*args: ndarray) → Union[ndarray, Tuple[ndarray, ]]
Apply a forward pass on args with the equivalent numpy function only.
Args:
*args: the inputs of the forward function
Returns:
Union[numpy.ndarray, Tuple[numpy.ndarray, ...]]: result of the forward on the given inputs
method pre_processing
pre_processing(*args: ndarray) → Tuple[ndarray, ]
Apply a preprocessing pass on args with the equivalent numpy function only.
Args:
*args: the inputs of the preprocessing function
Returns:
Union[numpy.ndarray, Tuple[numpy.ndarray, ...]]: result of the preprocessing on the given inputs or the original inputs if no preprocessing function is defined