ModelABC

class mfai.pytorch.models.base.ModelABC[source]

Bases: ABC

check_required_attributes()[source]
Return type:

None

abstract property features_last: bool

Indicates if the features are the last dimension in the input/output tensors. Conv and ViT typically have features as the second dimension (Batch, Features, …) versus GNNs for which features are the last dimension (Batch, …, Features).

property features_second: bool
in_channels: int
input_shape: tuple[int, ...]
abstract property model_type: ModelType

Returns the model type.

abstract property num_spatial_dims: int

Returns the number of spatial dimensions of the instanciated model.

abstract property onnx_supported: bool

Indicates if our model supports onnx export.

out_channels: int
register: bool = False
abstract property settings: Any

Returns the settings instance used to configure for this model.

abstract property settings_kls: Any

Returns the settings class for this model.

abstract property supported_num_spatial_dims: tuple[int, ...]

Returns the number of input spatial dimensions supported by the model. A 2d vision model supporting (H, W) should return (2,). A model supporting both 2d and 3d inputs (by settings) should return (2, 3). Once instanciated the model will be in 2d OR 3d mode.