speechbrain.nnet.quaternion_networks.q_normalization module¶
Library implementing quaternion-valued normalization.
- Authors
Titouan Parcollet 2020
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:
torch.nn.modules.module.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])
-
forward
(input)[source]¶ Returns the normalized input tensor.
- Parameters
input (torch.Tensor (batch, time, [channels])) – Input to normalize. It can be 2d, 3d, 4d.