First, HadamardProd inherits from nn.Function but the examples all inherit from either torch.nn.Module or torch.autograd.Function. Changing that might help
It looks like your module is doing simple calculations using pytorch operations. If that is case I would suggest leaving out the backward function. PyTorch will figure it out on its own. This should work. I also changed the inplace add to an ordinary add, though this might not be entirely necessary.
class HadamardProd(torch.autograd.Function):
    @staticmethod
    def forward(ctx, input, weight, bias=None):
          output = torch.mul(input, weight)
          if bias is not None:
              output = output + bias
          return output

That should help you along even though it doesn’t answer your specific question.