hello, thanks for your reply, when we update weight in the case of images, then shouldn’t it be like if one representation is updated then, it is not necessary that other representations would also be updated, for example, in the case of text, if we have a learnt representation of a word, lets say apple, then if we want to change this representation then we would update the weights associated with this word apple, and no other word in our vocab would be updated, for example if our vocab had another word grape, then its representation would not be updated, but when we train neural network on images, then if we want our neural network to change the learnt representation for one image, then why do we update all the weights, shouldn’t it be like, if we want to update representation of one image, then only certain weights associated with that image get updated, and all the other representations stay as they were, so notion of dropout/pruning would mean not changing representation of any other pattern, so if we had images of objects, lets say, and , then during training of neural network either only weights associated with get updated, or weights associated with  get updated, and not all the weights in our neural network.
for example, if I have two, 1 channel, 5x5 images
x = torch.randn(2, 1, 5, 5)

then I would represent each of these 25 pixels in each image with lets say 10 numbers (weights), something like
pixel1 -> [10 weights]
pixel2 -> [10 weights]
...
pixel25 -> [10 weights]

and then during training, I update these, lets say I carry a dot product between neighbouring pixels for each 3x3 sized kernel, and get a learnt representation of each of these pixels, so after training, these pixels would be,
pixel1 -> [learnt 10 weights]
pixel2 -> [learnt 10 weights]
...
pixel25 -> [learnt 10 weights]

and then compute loss using crossentropy, and I only update representaion of pixels associate with the image that has been predicted incorrectly. So if my neural network predicted  incorrectly, then I would update the representaion of its 25 pixels, nothing else.
currently, my neural netowrk look something like, but it give me high loss.
import torch.nn as nn
import torch.nn.functional as F


class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        # self.conv1 = nn.Conv2d(3, 6, 5)
        # self.pool = nn.MaxPool2d(2, 2)
        # self.conv2 = nn.Conv2d(6, 16, 5)
        # self.fc1 = nn.Linear(16 * 5 * 5, 120)
        # self.fc2 = nn.Linear(120, 84)
        self.fc1 = nn.Linear(3072*10, 1000)
        self.fc2 = nn.Linear(1000, 100)
        self.fc3 = nn.Linear(100, 10)
        self.embedding = nn.Embedding(512, 10)

    def forward(self, x):
        # print(x.shape)
        # print(x.shape)
        x = ((x.reshape(4, 3*32*32))*255 + 256).long()
        # print(x)
        x = self.embedding(x)
        # print(x)
        x = x.reshape(4, 3, 32, 32, 10)
        y = x.unfold(2, 1, 1).unfold(3, 1, 1).reshape(4, 3, 32, 32, 10, 1, 1) # extract 1x1 patches
        z = x.unfold(2, 3, 1).unfold(3, 3, 1).reshape(4, 3, 30, 30, 10, 9) # extract 3x3 patches
        out = torch.einsum('abcdefg, abijek -> abcde', y, z) # learnt representation of each pixel
        out = out.reshape(4, 3*32*32*10)
        out = self.fc1(out)
        out = self.fc2(out)
        out = self.fc3(out)
        
        # print('final output:', out)
        return out


net = Net().cuda()

on this tutorial, https://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html
it appear to me like, I do unfolding and einsum incorrectly.