Hi
I am using CNN to classify text. The CNN input dimensions are BxM where B is batchsize and M is number of words/features (0 padded to length of max feature size in the batch). M varies from batch to batch. I would like to batchnormalize the input before the nn.Embedding() layer. How can I do this if I do not know size of M apriori when setting the model up?
class Testmodel(nn.Module):
    def __init__(self, args):
        super(Testmodel,self).__init__()
        self.args = args

        V = args.embed_num
        D = args.embed_dim
        
        self.embed = nn.Embedding(V, D)
        ......

        self.fc1 = nn.Linear(1000, C)

and the forward
def forward(self, x):
        x = self.embed(x) 
        ....
        logit = self.fc1(x)
        return logit

Thank you