Getting dimension out of range while normalizing weight

I am trying to normalize the weight that I get from embedding layer using F.normalize function but getting error as “IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)”.
Not sure why.

def forward(self, imgs):

        ### complete the forward path --------------------

        cls_scores = []
        ## YOUR CODE HERE
        for i in range(len(self.classes)):
            v = self.backbone(imgs)
            class_out = random.choice(self.classes)
            class_out = self.classes.index(class_out)
            class_out = torch.tensor(class_out)
            wt = self.embeddings(class_out) # not sure what should be the input
            wt_normalized = F.normalize(wt, p=2, dim=1)        
            self.dc.weight = nn.Parameter(wt_normalized)            
            v_out = self.dc(v)
            out = nn.Upsample(size=(8, 8), mode='bilinear')(v_out)
            out = nn.Upsample(size=(64, 64), mode='bilinear')(v_out)
            score = self.mlp(out)
        ### ----------------------------------------------

        return cls_scores # Dim: [batch_size, 10]

Based on the error message, if seems wt has only a single dimension.
If you want to normalize using dim=1, make sure your tensor has at least two valid dims:

F.normalize(torch.randn(10, 10), p=2, dim=1) # works
F.normalize(torch.randn(10), p=2, dim=1) # throws your error