luz.model module¶
- class Model(net, input_transform=None, output_transform=None)¶
Bases:
torch.nn.modules.module.Module
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- eval(no_grad=True)¶
Context manager to operate in eval mode.
- Parameters
no_grad (
Optional
[bool
]) – If True use torch.no_grad(), by default True.- Return type
None
- forward(*args, **kwargs)¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.- Return type
Tensor
- load(path)¶
- property num_parameters: int¶
Number of trainable parameters.
- Returns
Number of trainable parameters.
- Return type
int
- predict(x)¶
Compute forward pass in eval mode.
- Parameters
x (
Tensor
) – Input tensor.- Returns
Output tensor.
- Return type
torch.Tensor
- save(path)¶
- Return type
None
- training: bool¶