Register_hook with respect to a subtensor of a tensor
Assuming that we would like to modify gradients only of a part of the variable values, is it possible to register_hook in pytorch only to a subtensor (of a tensor that is a pytorch variable)?

We can make a function where we modify the part of the tensor as follows:

def gradi(module):
    module[1]=0

h = net.param_name.register_hook(gradi)

