Custom autograd.Function: must it be static?

Hi,
Could someone please help me in converting this snippet to the newer way of defining custom layers:

class GradReverse(Function):
    def __init__(self, lambd):
        self.lambd = lambd
    #@staticmethod
    def forward(self, x):
        return x.view_as(x)
    #@staticmethod
    def backward(self, grad_output):
        return (grad_output * -self.lambd)```

Thanks a lot,
Megh