vgslify.torch package
Submodules
vgslify.torch.layers module
- class vgslify.torch.layers.TorchLayerFactory(input_shape=None)[source]
Bases:
LayerFactory
TorchLayerFactory is responsible for creating PyTorch-specific layers based on parsed VGSL (Variable-size Graph Specification Language) specifications.
This factory handles the creation of various types of layers, including convolutional layers, pooling layers, RNN layers, dense layers, activation layers, and more.
- layers
A list of PyTorch layers that have been added to the factory.
- Type:
list
- shape
The current shape of the tensor, excluding the batch size.
- Type:
tuple of int
- _input_shape
The original input shape provided during initialization.
- Type:
tuple of int or None
- build(name='VGSL_Model')[source]
Build the final model using the accumulated layers.
- Parameters:
name (str, optional) – The name of the model, by default “VGSL_Model”
- Returns:
The constructed PyTorch model.
- Return type:
torch.nn.Module
- Raises:
ValueError – If no layers have been added to the model.
ValueError – If no input shape has been specified for the model.