レイヤー¶
基本的なニューラルネットワークレイヤーを提供するモジュールです。
ml_networks.torch.layers(PyTorch)とml_networks.jax.layers(JAX)の両方で提供されています。
MLPLayer¶
MLPLayer ¶
Bases: LightningModule
Multi-layer perceptron layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dim
|
int
|
Input dimension. |
required |
output_dim
|
int
|
Output dimension. |
required |
cfg
|
MLPConfig
|
|
required |
Examples:
>>> cfg = MLPConfig(
... hidden_dim=16,
... n_layers=3,
... output_activation="ReLU",
... linear_cfg=LinearConfig(
... activation="ReLU",
... norm="layer",
... norm_cfg={"eps": 1e-05, "elementwise_affine": True, "bias": True},
... dropout=0.1,
... norm_first=False,
... bias=True
... )
... )
>>> mlp = MLPLayer(32, 16, cfg)
>>> x = torch.randn(1, 32)
>>> output = mlp(x)
>>> output.shape
torch.Size([1, 16])
Source code in src/ml_networks/torch/layers.py
LinearNormActivation¶
LinearNormActivation ¶
Bases: Module
Linear layer with normalization and activation, and dropouts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dim
|
int
|
Input dimension. |
required |
output_dim
|
int
|
Output dimension. |
required |
cfg
|
LinearConfig
|
Linear layer configuration. |
required |
References
LayerNorm: https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html RMSNorm: https://pytorch.org/docs/stable/generated/torch.nn.RMSNorm.html Linear: https://pytorch.org/docs/stable/generated/torch.nn.Linear.html Dropout: https://pytorch.org/docs/stable/generated/torch.nn.Dropout.html
Examples:
>>> cfg = LinearConfig(
... activation="ReLU",
... norm="layer",
... norm_cfg={"eps": 1e-05, "elementwise_affine": True, "bias": True},
... dropout=0.1,
... norm_first=False,
... bias=True
... )
>>> linear = LinearNormActivation(32, 16, cfg)
>>> linear
LinearNormActivation(
(linear): Linear(in_features=32, out_features=16, bias=True)
(norm): LayerNorm((16,), eps=1e-05, elementwise_affine=True)
(activation): Activation(
(activation): ReLU()
)
(dropout): Dropout(p=0.1, inplace=False)
)
>>> x = torch.randn(1, 32)
>>> output = linear(x)
>>> output.shape
torch.Size([1, 16])
>>> cfg = LinearConfig(
... activation="SiGLU",
... norm="none",
... norm_cfg={},
... dropout=0.0,
... norm_first=True,
... bias=True
... )
>>> linear = LinearNormActivation(32, 16, cfg)
>>> # If activation includes "glu", linear output_dim is doubled to adjust actual output_dim.
>>> linear
LinearNormActivation(
(linear): Linear(in_features=32, out_features=32, bias=True)
(norm): Identity()
(activation): Activation(
(activation): SiGLU()
)
(dropout): Identity()
)
>>> x = torch.randn(1, 32)
>>> output = linear(x)
>>> output.shape
torch.Size([1, 16])
Source code in src/ml_networks/torch/layers.py
Attributes¶
linear
instance-attribute
¶
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (*, input_dim) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (*, output_dim) |
Source code in src/ml_networks/torch/layers.py
ConvNormActivation¶
ConvNormActivation ¶
Bases: Module
Convolutional layer with normalization and activation, and dropouts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Input channels. |
required |
out_channels
|
int
|
Output channels. |
required |
cfg
|
ConvConfig
|
Convolutional layer configuration. |
required |
References
PixelShuffle: https://pytorch.org/docs/stable/generated/torch.nn.PixelShuffle.html PixelUnshuffle: https://pytorch.org/docs/stable/generated/torch.nn.PixelUnshuffle.html BatchNorm2d: https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html GroupNorm: https://pytorch.org/docs/stable/generated/torch.nn.GroupNorm.html LayerNorm: https://pytorch.org/docs/stable/generated/torch.nn.LayerNorm.html InstanceNorm2d: https://pytorch.org/docs/stable/generated/torch.nn.InstanceNorm2d.html Conv2d: https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html Dropout: https://pytorch.org/docs/stable/generated/torch.nn.Dropout.html
Examples:
>>> cfg = ConvConfig(
... activation="ReLU",
... kernel_size=3,
... stride=1,
... padding=1,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.1,
... norm="batch",
... norm_cfg={"affine": True, "track_running_stats": True},
... scale_factor=0
... )
>>> conv = ConvNormActivation(3, 16, cfg)
>>> x = torch.randn(1, 3, 32, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32, 32])
>>> cfg = ConvConfig(
... activation="SiGLU",
... kernel_size=3,
... stride=1,
... padding=1,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.0,
... norm="none",
... norm_cfg={},
... scale_factor=2
... )
>>> conv = ConvNormActivation(3, 16, cfg)
>>> x = torch.randn(1, 3, 32, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 64, 64])
Source code in src/ml_networks/torch/layers.py
Attributes¶
conv
instance-attribute
¶
conv = Conv2d(in_channels=in_channels, out_channels=out_channels_, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, padding_mode=padding_mode)
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, in_channels, H, W) or (in_channels, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, out_channels, H', W') or (out_channels, H', W') |
H' and W' are calculated as follows:
|
|
H' = (H + 2*padding - dilation * (kernel_size - 1) - 1) // stride + 1
|
|
H' = H' * scale_factor if scale_factor > 0 else H' // abs(scale_factor) if scale_factor < 0 else H'
|
|
W' = (W + 2*padding - dilation * (kernel_size - 1) - 1) // stride + 1
|
|
W' = W' * scale_factor if scale_factor > 0 else W' // abs(scale_factor) if scale_factor < 0 else W'
|
|
Source code in src/ml_networks/torch/layers.py
ConvNormActivation1d¶
ConvNormActivation1d ¶
Bases: Module
1D Convolutional layer with normalization and activation, and dropouts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Input channels. |
required |
out_channels
|
int
|
Output channels. |
required |
cfg
|
ConvConfig
|
Convolutional layer configuration. |
required |
Examples:
>>> cfg = ConvConfig(
... activation="ReLU",
... kernel_size=3,
... stride=1,
... padding=1,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.1,
... norm="batch",
... norm_cfg={"affine": True, "track_running_stats": True},
... padding_mode="zeros"
... )
>>> conv = ConvNormActivation1d(3, 16, cfg)
>>> x = torch.randn(1, 3, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32])
>>> cfg = ConvConfig(
... activation="SiGLU",
... kernel_size=3,
... stride=1,
... padding=1,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.0,
... norm="none",
... norm_cfg={},
... padding_mode="zeros"
... )
>>> conv = ConvNormActivation1d(3, 16, cfg)
>>> x = torch.randn(1, 3, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32])
Source code in src/ml_networks/torch/layers.py
Attributes¶
conv
instance-attribute
¶
conv = Conv1d(in_channels=in_channels, out_channels=out_channels_, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias, padding_mode=padding_mode)
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, in_channels, L) or (in_channels, L) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, out_channels, L') or (out_channels, L') |
L' is calculated as follows:
|
|
L' = (L + 2*padding - dilation * (kernel_size - 1) - 1) // stride + 1
|
|
Source code in src/ml_networks/torch/layers.py
ConvTransposeNormActivation¶
ConvTransposeNormActivation ¶
Bases: Module
Transposed convolutional layer with normalization and activation, and dropouts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Input channels. |
required |
out_channels
|
int
|
Output channels. |
required |
cfg
|
ConvConfig
|
Convolutional layer configuration. |
required |
Examples:
>>> cfg = ConvConfig(
... activation="ReLU",
... kernel_size=3,
... stride=1,
... padding=1,
... output_padding=0,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.1,
... norm="batch",
... norm_cfg={"affine": True, "track_running_stats": True}
... )
>>> conv = ConvTransposeNormActivation(3, 16, cfg)
>>> x = torch.randn(1, 3, 32, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32, 32])
>>> cfg = ConvConfig(
... activation="SiGLU",
... kernel_size=3,
... stride=1,
... padding=1,
... output_padding=0,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.0,
... norm="none",
... norm_cfg={}
... )
>>> conv = ConvTransposeNormActivation(3, 16, cfg)
>>> x = torch.randn(1, 3, 32, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32, 32])
Source code in src/ml_networks/torch/layers.py
Attributes¶
conv
instance-attribute
¶
conv = ConvTranspose2d(in_channels, out_channels * 2 if 'glu' in lower() else out_channels, kernel_size, stride, padding, output_padding, groups, bias=bias, dilation=dilation)
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, in_channels, H, W) or (in_channels, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, out_channels, H', W') or (out_channels, H', W') |
H' and W' are calculated as follows:
|
|
H' = (H - 1) * stride - 2 * padding + kernel_size + output_padding
|
|
W' = (W - 1) * stride - 2 * padding + kernel_size + output_padding
|
|
Source code in src/ml_networks/torch/layers.py
ConvTransposeNormActivation1d¶
ConvTransposeNormActivation1d ¶
Bases: Module
1D Transposed convolutional layer with normalization and activation, and dropouts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_channels
|
int
|
Input channels. |
required |
out_channels
|
int
|
Output channels. |
required |
cfg
|
ConvConfig
|
Convolutional layer configuration. |
required |
Examples:
>>> cfg = ConvConfig(
... activation="ReLU",
... kernel_size=3,
... stride=1,
... padding=1,
... output_padding=0,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.1,
... norm="batch",
... )
>>> conv = ConvTransposeNormActivation1d(3, 16, cfg)
>>> x = torch.randn(1, 3, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32])
>>> cfg = ConvConfig(
... activation="SiGLU",
... kernel_size=3,
... stride=1,
... padding=1,
... output_padding=0,
... dilation=1,
... groups=1,
... bias=True,
... dropout=0.0,
... norm="none",
... norm_cfg={}
... )
>>> conv = ConvTransposeNormActivation1d(3, 16, cfg)
>>> x = torch.randn(1, 3, 32)
>>> output = conv(x)
>>> output.shape
torch.Size([1, 16, 32])
Source code in src/ml_networks/torch/layers.py
Attributes¶
conv
instance-attribute
¶
conv = ConvTranspose1d(in_channels=in_channels, out_channels=out_channels * 2 if 'glu' in lower() else out_channels, kernel_size=kernel_size, stride=stride, padding=padding, output_padding=output_padding, groups=groups, bias=bias, dilation=dilation)
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, in_channels, L) or (in_channels, L) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, out_channels, L') or (out_channels, L') |
L' is calculated as follows:
|
|
L' = (L - 1) * stride - 2 * padding + kernel_size + output_padding
|
|
Source code in src/ml_networks/torch/layers.py
ResidualBlock¶
ResidualBlock ¶
ResidualBlock(in_features, kernel_size, activation='ReLU', norm='none', norm_cfg=None, dropout=0.0, padding_mode='zeros')
Bases: Module
Residual block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_features
|
int
|
Input features. |
required |
kernel_size
|
int
|
Kernel size. |
required |
activation
|
str
|
Activation function. |
'ReLU'
|
norm
|
Literal['batch', 'group', 'none']
|
Normalization layer. If it's set to "none", normalization is not applied. Default is "none". |
'none'
|
norm_cfg
|
dictConfig
|
Normalization layer configuration. Default is {}. |
None
|
dropout
|
float
|
Dropout rate. If it's set to 0.0, dropout is not applied. Default is 0.0. |
0.0
|
Examples:
>>> resblock = ResidualBlock(16, 3, "ReLU", "batch", {}, 0.1)
>>> x = torch.randn(1, 16, 32, 32)
>>> output = resblock(x)
>>> output.shape
torch.Size([1, 16, 32, 32])
Source code in src/ml_networks/torch/layers.py
Attributes¶
conv_block
instance-attribute
¶
conv_block = Sequential(ConvNormActivation(in_features, in_features, first_cfg), ConvNormActivation(in_features, in_features * 2 if 'glu' in lower() else in_features, second_cfg))
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, in_features, H, W) or (in_features, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, in_features, H, W) or (in_features, H, W) |
Source code in src/ml_networks/torch/layers.py
Attention1d¶
Attention1d ¶
Bases: Module
1d自己注意機構.
Source code in src/ml_networks/torch/layers.py
Attributes¶
Functions¶
forward ¶
Source code in src/ml_networks/torch/layers.py
qkv_attention ¶
Apply QKV attention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qkv
|
Tensor
|
An [N x (H * 3 * C) x T] tensor of Qs, Ks, and Vs. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
An [N x (H * C) x T] tensor after attention. |
Source code in src/ml_networks/torch/layers.py
Attention2d¶
Attention2d ¶
Bases: Module
2d自己注意機構.
Args: channels (int): 入力・出力チャンネル数 nhead (int): 注意ヘッドの数
Examples:
>>> attn = Attention2d(channels=64, nhead=8)
>>> x = torch.randn(2, 64, 32, 32)
>>> out = attn(x)
>>> out.shape
torch.Size([2, 64, 32, 32])
Source code in src/ml_networks/torch/layers.py
Attributes¶
Functions¶
forward ¶
Source code in src/ml_networks/torch/layers.py
qkv_attn ¶
Apply QKV attention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qkv
|
Tensor
|
An [N x (Heads * 3 * C) x H x W] tensor of query, key, value. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
An [N x (C * Head) x H x W] tensor of attended values. |
Source code in src/ml_networks/torch/layers.py
TransformerLayer¶
TransformerLayer ¶
Bases: Module
Transformer layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dim
|
int
|
Input dimension. |
required |
output_dim
|
int
|
Output dimension. |
required |
cfg
|
TransformerConfig
|
Transformer layer configuration. |
required |
Examples:
>>> cfg = TransformerConfig(
... d_model=16,
... nhead=4,
... dim_ff=64,
... n_layers=3,
... dropout=0.1,
... hidden_activation="ReLU",
... output_activation="ReLU"
... )
>>> transformer = TransformerLayer(32, 16, cfg)
>>> x = torch.randn(1, 8, 32)
>>> output = transformer(x)
>>> output.shape
torch.Size([1, 8, 16])
Source code in src/ml_networks/torch/layers.py
Attributes¶
in_proj
instance-attribute
¶
in_proj = Sequential(Linear(input_dim, d_model), LayerNorm(d_model), Activation(hidden_activation)) if input_dim != d_model else Identity()
out_proj
instance-attribute
¶
out_proj = Sequential(Linear(d_model, output_dim), Activation(output_activation)) if output_dim else Activation(output_activation)
transformer
instance-attribute
¶
transformer_layer
instance-attribute
¶
transformer_layer = TransformerEncoderLayer(d_model=d_model, nhead=nhead, dim_feedforward=dim_feedforward, activation=lower(), dropout=dropout, batch_first=True)
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, L, input_dim) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, L, output_dim) |
Source code in src/ml_networks/torch/layers.py
SpatialSoftmax¶
SpatialSoftmax ¶
Bases: Module
Spatial Softmax and Flatten layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
SpatialSoftmaxConfig
|
Spatial softmax configuration. |
required |
Examples:
>>> cfg = SpatialSoftmaxConfig(temperature=1.0, is_argmax=True)
>>> spatial_softmax = SpatialSoftmax(cfg)
>>> x = torch.randn(1, 64, 16, 16)
>>> output = spatial_softmax(x)
>>> output.shape
torch.Size([1, 64, 2])
Source code in src/ml_networks/torch/layers.py
Attributes¶
Functions¶
forward ¶
順伝播.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
B: バッチサイズ、N: トークン数、H: 高さ、W: 幅 |
required |
Returns:
| Type | Description |
|---|---|
Spatial Softmaxを適用した特徴量。形状は、(B, N, D)。
|
|
Source code in src/ml_networks/torch/layers.py
spatial_argmax2d ¶
Spatial Softmax and Argmax layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
入力特徴量。形状は、(B, N, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Spatial Softmaxを適用した特徴量。形状は、(B, N, 2)。 |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is not a torch.Tensor. |
ValueError
|
If input shape is not 4D. |
Source code in src/ml_networks/torch/layers.py
spatial_softmax_straight_through ¶
Spatial Softmax and Argmax layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
入力特徴量。形状は、(B, N, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Spatial Softmaxを適用した特徴量。形状は、(B, N, 2)。 |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is not a torch.Tensor. |
ValueError
|
If input shape is not 4D. |
Source code in src/ml_networks/torch/layers.py
PatchEmbed¶
PatchEmbed ¶
Bases: Module
Patch embedding layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
emb_dim
|
int
|
Embedding dimension. |
required |
patch_size
|
int
|
Patch size. |
required |
obs_shape
|
Tuple[int, int, int]
|
Observation shape. |
required |
Examples:
>>> patch_embed = PatchEmbed(16, 4, (3, 32, 32))
>>> x = torch.randn(1, 3, 32, 32)
>>> output = patch_embed(x)
>>> output.shape
torch.Size([1, 64, 16])
Source code in src/ml_networks/torch/layers.py
Attributes¶
patch_emb_layer
instance-attribute
¶
patch_emb_layer = Conv2d(in_channels=obs_shape[0], out_channels=emb_dim, kernel_size=patch_size, stride=patch_size)
patch_num
instance-attribute
¶
Functions¶
forward ¶
Forward pass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Tensor
|
Input tensor of shape (B, C, H, W) |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Output tensor of shape (B, Np, D) |
Np is the number of patches.
|
Np = H*W/P^2 |
D is the embedding dimension.
|
|
Source code in src/ml_networks/torch/layers.py
PositionalEncoding¶
PositionalEncoding ¶
Bases: Module
Positional encoding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
d_model
|
int
|
Dimension of model. |
required |
dropout
|
float
|
Dropout rate. If it's set to 0.0, dropout is not applied. |
required |
max_len
|
int
|
Maximum length. |
required |
Examples:
>>> pos_enc = PositionalEncoding(16, 0.1, 100)
>>> x = torch.randn(1, 8, 16)
>>> output = pos_enc(x)
>>> output.shape
torch.Size([1, 8, 16])
Source code in src/ml_networks/torch/layers.py
get_norm¶
get_norm ¶
Get normalization layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
norm
|
Literal['layer', 'rms', 'group', 'batch', 'none']
|
Normalization layer. If it's set to "none", normalization is not applied. |
required |
kwargs
|
dict
|
Normalization layer configuration. |
{}
|
Returns:
| Type | Description |
|---|---|
Module
|
Normalization layer. |
Examples:
>>> cfg = {"normalized_shape": 1, "eps": 1e-05, "elementwise_affine": True, "bias": True}
>>> norm = get_norm("layer", **cfg)
>>> norm
LayerNorm((1,), eps=1e-05, elementwise_affine=True)
>>> cfg = {"normalized_shape": 1, "eps": 1e-05, "elementwise_affine": True}
>>> norm = get_norm("rms", **cfg)
>>> norm
RMSNorm((1,), eps=1e-05, elementwise_affine=True)
>>> cfg = {"num_groups": 1, "num_channels": 12, "eps": 1e-05, "affine": True}
>>> norm = get_norm("group", **cfg)
>>> norm
GroupNorm(1, 12, eps=1e-05, affine=True)
>>> cfg = {"num_features": 1, "eps": 1e-05, "momentum": 0.1, "affine": True, "track_running_stats": True}
>>> norm = get_norm("batch2d", **cfg)
>>> norm
BatchNorm2d(1, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
>>> cfg = {"num_features": 1, "eps": 1e-05, "momentum": 0.1, "affine": True, "track_running_stats": True}
>>> norm = get_norm("batch1d", **cfg)
>>> norm
BatchNorm1d(1, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)