Fix version check for grad_fn for views (#34145)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/34145
This fix the following behavior:
```python
import torch
class MyFn(torch.autograd.Function):
staticmethod
def forward(ctx, inp, inplace):
view = inp.clone()[:3]
if inplace:
view += 2
return view
staticmethod
def backward(ctx, grad):
return grad, None
base = torch.rand(10, requires_grad=True)
foo = MyFn.apply(base, False)
print(foo.grad_fn)
# <torch.autograd.function.MyFnBackward object at 0x7f5fd28c4d18>
foo = MyFn.apply(base, True)
print(foo.grad_fn)
# <AsStridedBackward object at 0x7f601c0c3cf0>
```
Where both should be printing `MyFnBackward`.
Test Plan: Imported from OSS
Differential Revision: D20229907
Pulled By: albanD
fbshipit-source-id: 5ebd315d459023017d51760c5bafe43acd5fc3e2