I tested register_backward_hook on nn.Sequential as below.
import torch
import torch.nn as nn
from torch.autograd import Variable

a = nn.Sequential(nn.Linear(5,3), nn.Tanh(), nn.Linear(3,2))

def hookFunc(module, gradInput, gradOutput):
	print(len(gradInput))
	for v in gradInput:
		print v
a.register_backward_hook(hookFunc)

input = Variable(torch.randn(4,5))
output = a(input)

target = torch.FloatTensor(4,2).fill_(1)
output.backward(target)

The output is as follows.
3
Variable containing:
-0.1122  0.1216  0.7935
-0.1122  0.1216  0.7935
-0.1122  0.1216  0.7935
-0.1122  0.1216  0.7935
[torch.FloatTensor of size 4x3]
Variable containing:
-0.5910 -0.7340 -0.4239
-0.5910 -0.7340 -0.4239
[torch.FloatTensor of size 2x3]

Variable containing:
 4
 4
[torch.FloatTensor of size 2]

So, it seems that when using register_backward_hook on nn.Sequential, only the gradient related values on the last element of nn.Sequential are returned.
I wonder if this is intended one or not. To get the gradient values for the specific element, should I hook with specifying that element rather than specifying nn.Sequential module?
Another question is, I wonder why the description on http://pytorch.org/docs/_modules/torch/nn/modules/module.html#Module.register_backward_hook 265 says that the hook shouldn’t modify the arguments (gradInput for example.) Are there any reason? Then, what would be a better way to manually modify gradient inputs that would be backward passed to the previous module?