scimba_torch.neural_nets.coordinates_based_nets.siren¶
Siren architecture implementation.
Classes
|
Class representing a Siren Layer. |
|
Class representing a Siren architecture with optional ResNet layers. |
- class SirenLayer(in_size, out_size, w0=1, c=6, is_first=False, use_bias=True)[source]¶
Bases:
ModuleClass representing a Siren Layer.
- Parameters:
in_size (
int) – Dimension of the inputs.out_size (
int) – Dimension of the outputs.w0 (
int) – Frequency parameter. Defaults to 1.c (
int) – Initialization parameter. Defaults to 6.is_first (
bool) – Whether this is the first layer. Defaults to False.use_bias (
bool) – Whether to use bias. Defaults to True.
- in_size¶
Dimension of the inputs.
- is_first¶
Whether this is the first layer.
- out_size¶
Dimension of the outputs.
- layer¶
The linear layer applied to the vector of features.
- activation¶
The sine activation function.
- init_(weight, bias, c, w0)[source]¶
Init the weights of the layer using the specific Siren initialization.
- Parameters:
weight (
Tensor) – The weight of the layer to initialize.bias (
Tensor) – The bias of the layer to initialize.c (
int) – A parameter for the weight initialization.w0 (
int) – The frequency of the sinus activation function.
- class SirenNet(in_size, out_size, **kwargs)[source]¶
Bases:
ScimbaModuleClass representing a Siren architecture with optional ResNet layers.
- Parameters:
in_size (
int) – dimension of inputsout_size (
int) – dimension of outputs**kwargs –
Additional keyword arguments:
w (
int): frequency for the internal layers’ activation functionsw0 (
int): frequency for the first layer’s activation functionlayer_sizes (
list[int]): list of the size for each layeruse_res_net (
bool, default=False): whether to use a ResNet architecture
- layers¶
list of Siren layers, potentially with residual connections