Pytorch Generator¶
This module defines the PyTorchGenerator class that generates PyTorch code for neural networks based on the B-UML model.
- class besser.generators.nn.pytorch.pytorch_code_generator.PytorchGenerator(model: NN, output_dir: str | None = None, generation_type: str = 'subclassing', channel_last: bool = False)[source]¶
Bases:
NNCodeGeneratorPytorchGenerator is a class that inherits from NNCodeGenerator. It generates Pytorch code for neural networks training and evaluation based on the B-UML input model.
- setup_layer¶
The class that defines the syntax of layers.
- Type:
SetupLayerSyntax
- setup_tensorop¶
The function that defines the syntax of tensorops.
- Type:
Callable
- output_dir¶
The output directory where the generated code will be saved. Defaults to None.
- Type:
str, optional
- channel_last¶
If true, PyTorch conv layers will have their input and output permuted to match TF convention.
- Type:
bool, optional
- _abc_impl = <_abc._abc_data object>¶