Apply 1D CNN to time-series data + Temporal Adaptive Normalization

Hello,
I am quite new to python/pytorch and I would like to implement a ‘Temporal Adaptive Batch Normalization’ as described in the picture.

Can someone help me? This is an example of a code below:

import torch.nn as nn
import torch.nn.functional as F

class model(nn.Module):
def init(self):
super(model, self).init()
self.conv1 = nn.Conv1d(1, 18, kernel_size=3)
self.conv2 = nn.Conv1d(18, 36, kernel_size=3)
self.conv2_drop = nn.Dropout2d() #dropout
self.fc1 = nn.Linear(1536, 72) #Fully-connected classifier layer
self.fc2 = nn.Linear(72, 19) #Fully-connected classifier layer

def forward(self, x):
    x = x.unsqueeze(1) # create an additional channel dimension (only 1 channel here)
    x = F.relu(F.max_pool1d(self.conv1(x), 2))
    print(x.shape)
    x = F.relu(F.max_pool1d(self.conv2_drop(self.conv2(x)),2))
    print(x.shape)
    return x