algeriapy:

shap1 = feaco2.matmul(self.w)


I still see shap1 = feaco2.matmul(self.w) rather than a layer being used. What happens when you replace the feaco2.matmul(self.w) with something like self.fc3(feaco2)?
However, if you are referring to the rest of the model weights not changing, I think this is because  torch.nn.functional.one_hot(torch.argmax(feaco1, dim=1), num_classes=10).float() is not differentiable. You might want to consider replacing this with a softmax instead which is differentiable.