Skip to content

InputConversion

Bases: Generic[FT, PT], ABC

The input conversion for a neural network, defines the input parameters for the neural network.

Source code in src/safeds/ml/nn/converters/_input_converter.py
class InputConversion(Generic[FT, PT], ABC):
    """The input conversion for a neural network, defines the input parameters for the neural network."""

    @property
    @abstractmethod
    def _data_size(self) -> int | ModelImageSize: ...

    @abstractmethod
    def _data_conversion_fit(
        self,
        input_data: FT,
        batch_size: int,
        num_of_classes: int = 1,
    ) -> DataLoader | ImageDataset: ...

    @abstractmethod
    def _data_conversion_predict(self, input_data: PT, batch_size: int) -> DataLoader | _SingleSizeImageList: ...

    @abstractmethod
    def _data_conversion_output(self, input_data: PT, output_data: Tensor) -> FT: ...

    @abstractmethod
    def _is_fit_data_valid(self, input_data: FT) -> bool: ...

    @abstractmethod
    def _is_predict_data_valid(self, input_data: PT) -> bool: ...