speechbrain.nnet.quaternion_networks.q_normalization module
Library implementing quaternion-valued normalization.
- Authors
Titouan Parcollet 2020
Drew Wagner 2024
Summary
Classes:
This class implements the simplest form of a quaternion batchnorm as described in : "Quaternion Convolutional Neural Network for Color Image Classification and Forensics", Qilin Y. |
Reference
- class speechbrain.nnet.quaternion_networks.q_normalization.QBatchNorm(input_size, dim=-1, gamma_init=1.0, beta_param=True, momentum=0.1, eps=0.0001, track_running_stats=True)[source]
Bases:
Module
This class implements the simplest form of a quaternion batchnorm as described in : “Quaternion Convolutional Neural Network for Color Image Classification and Forensics”, Qilin Y. et al.
- Parameters:
input_size (int) – Expected size of the dimension to be normalized.
dim (int, optional) – It defines the axis that should be normalized. It usually correspond to the channel dimension (default -1).
gamma_init (float, optional) – First value of gamma to be used (mean) (default 1.0).
beta_param (bool, optional) – When set to True the beta parameter of the BN is applied (default True).
momentum (float, optional) – It defines the momentum as for the real-valued batch-normalization (default 0.1).
eps (float, optional) – Term used to stabilize operation (default 1e-4).
track_running_stats (bool, optional) – Equivalent to the real-valued batchnormalization parameter. When True, stats are tracked. When False, solely statistics computed over the batch are used (default True).
Example
>>> inp_tensor = torch.rand([10, 40]) >>> QBN = QBatchNorm(input_size=40) >>> out_tensor = QBN(inp_tensor) >>> out_tensor.shape torch.Size([10, 40])