What does this code do in pytorch?

class GradientReverse(torch.autograd.Function):

  lambd = 1.0

  def forward(ctx, inp):
    out = inp.clone()
    return out

  def backward(ctx, grad_out):
    return grad_out.neg() * GradientReverse.lambd

def reverse_gradient(x, lambd):
  GradientReverse.lambd = lambd
  return GradientReverse.apply(x)

Any more article blog or information to understand the working of the above section of code will be helpful.
As I investigated, I found that this code is of gradient reversal layer.