Source code for pytagi.nn.layer_block

from typing import List

import cutagi

from pytagi.nn.base_layer import BaseLayer


[docs] class LayerBlock(BaseLayer): """A stack of different layers derived from BaseLayer""" def __init__(self, *layers: BaseLayer): """ Initialize the Sequential model with the given layers. Args: layers: A variable number of layers (instances of BaseLayer or derived classes). """ backend_layers = [layer._cpp_backend for layer in layers] self._cpp_backend = cutagi.LayerBlock(backend_layers)
[docs] def switch_to_cuda(self): """Convert all layers to cuda layer""" self._cpp_backend.switch_to_cuda()
@property
[docs] def layers(self) -> None: """Get layers""" return self._cpp_backend.layers
@layers.setter def layers(self, value: List[BaseLayer]): """Set base layers""" self._cpp_backend.layers = value