To modify gradients, use Variable hooks:
http://pytorch.org/docs/autograd.html#torch.autograd.Variable.register_hook 970
You can modify network weights directly. For example,
net.conv1.weight.data.clamp_(min=-1e-3, max=1e-3)