Hi
If I am understanding correctly you want to pass only 50% of weights to the optimizer and not to touch the remaining 50%.


You can’t use requires_grad =True as they work only at the level of tensors.


You can achieve this by masking 50% of your weights so that they don’t get updated.


Create a new tensor operation in the computational graph
mask = torch.zeros(weight.shape, requires_grad = False)
mask[0:501,:] = 1
newWeight = weight * mask

This small stub shows how to mask neurons and train. I hope you find this useful. I can explain better if more details(ie. Code) is given.
Thanks