# What is the meaning of function name grad_fn returns

Hi all,

I’m kind of new to PyTorch. I found it very interesting in 1.0 version that grad_fn attribute returns a function name with a number following it. like

``````>>> b
tensor([[2., 2.],
``````

I want to know the meaning of that 0 so I tried some more

The first different number I found is to calculate the mean of the tensor. It gives

``````>>> c=torch.mean(b)
>>> c
``````

The number after the function name becomes 1. When I explicitly give the dimension I want the mean, it gives

``````>>> d = torch.mean(b, dim=1)
>>> e = torch.mean(b, dim=0)
>>> d
>>> e
``````

The number became 0 again!

So I tried something similar, the standard deviation! However this time it runs slightly different

``````>>> f = torch.std(b)
>>> f
``````
``````>>> g = torch.std(b, dim=1)
>>> h = torch.std(b, dim=0)
>>> g
>>> h
``````

It’s just the opposite to what happened in `torch.mean`. When I specified the dimension the nubmer becomes 1 and when I didn’t the nubmer became 0.

These number, in basic algebra functions like addition and subtraction, only shows up in version 1.0.1. More complicated functions like `mean` and `std` perform exactly like the previous version (0.4.1). Following examples are calculated in PyTorch 0.4.1

``````>>> a = torch.zeros(2,2,requires_grad=True)
>>> b = a+2
>>> b
tensor([[2., 2.],
``````
``````>>> torch.mean(b)