When I use MyReLU.apply in forward of the method in a module, it does not work either:
class MyReLU(torch.autograd.Function):
    @staticmethod
    def forward(ctx, input):
        ctx.save_for_backward(input)
        return input.clamp(min=0)

    @staticmethod
    def backward(ctx, grad_output):
        grad_input = grad_output.clone()
        return grad_input


class weightedReLU(nn.Module):
    def __init__(self, weights = 1):
        super().__init__()
        self.weights = weights* nn.Parameter(torch.ones(1))
        self.weights = Variable(self.weights.data, requires_grad=True)
        
    def forward(self, input):
        ex = self.weights.cuda()*MyReLU.apply(input)
        return ex