Help in a program

x = torch.tensor([[1., -1.], [1., 1.]], requires_grad=True)
out = x.pow(2).sum()
out.backward()
x.grad

Please anyone tell me what does second line of this program mean??

I’m assuming you mean this line:
out = x.pow(2).sum()
You take the x tensor and apply power to each of the element of this tensor (each element to the power of 2).
You have some intermediate tensor that isn’t stored anywhere yet. Then you use sum() method, which adds every element of this tensor together and store it inside out tensor.

Since your x tensor looks like this:

1   -1
1    1

Applying power gives (intermediate tensor):

1    1
1    1

After summing up you get a tensor named out (with one dimension - a scalar) that has the value of 4.