In order to call custom backward passes in you custom nn.Module, you should define your own autograd.Functions an incorporate them in your nn.Module. Here’s a minimal dummy example:
import torch
import torch.autograd as autograd
import torch.nn as nn

class MyFun(torch.autograd.Function):
    def forward(self, inp):
        return inp

    def backward(self, grad_out):
        grad_input = grad_out.clone()
        print('Custom backward called!')
        return grad_input

class MyMod(nn.Module):
    def forward(self, x):
        return MyFun()(x)

mod = MyMod()

y = autograd.Variable(torch.randn(1), requires_grad=True)
z = mod(y)
z.backward()

running this script outputs
$ python dummy.py
Custom backward called!

Find more information in the following tutorial:
http://pytorch.org/tutorials/beginner/pytorch_with_examples.html#pytorch-defining-new-autograd-functions 259