I had seen a code aiming to convert PyTorch to Caffe. It looks like
raw_mul = torch.Tensor.__mul__
def mul(input, *args):
    x = raw_mul(input, *args)
    do something
torch.Tensor.__mul__ = mul

Not the most elegant solution.