torch.onnx.export does not track Tensor.data.size() for dynamic axes
Labels: module: onnx, triaged, onnx-triaged, release notes: onnx

### 🐛 Describe the bug

While I was implementing dynamic batch support for [nanodet](https://github.com/RangiLyu/nanodet), one of the output's batch size turned out to be statically defined. After some log reading, I found out data.size() is not tracked for dynamic axe. After changing into shape it was fixed.

I don't know if this is how it is supposed to work as there is no documentation about this.

Here is an example code that demonstrates the bug
``` python
import torch

class ExampleDataSize(torch.nn.Module):
    def forward(self, a):
        s = a.data.size()
        t = 0
        for i in range(4):
            t += s[i]
        return t


class ExampleShape(torch.nn.Module):
    def forward(self, a):
        s = a.shape
        t = 0
        for i in range(4):
            t += s[i]
        return t

data_size_ex = ExampleDataSize()
shape_ex = ExampleShape()

dummy_input = torch.autograd.Variable(
        torch.randn(1, 3, 64, 128)
    )

torch.onnx.export(
    data_size_ex,
    dummy_input,
    "data_size_ex.onnx",
    verbose=True,
    keep_initializers_as_inputs=True,
    opset_version=11,
    input_names=["data"],
    dynamic_axes={
        "data": [0, 1, 2, 3]
    },
    output_names=["output"],
)

torch.onnx.export(
    shape_ex,
    dummy_input,
    "shape_ex.onnx",
    verbose=True,
    keep_initializers_as_inputs=True,
    opset_version=11,
    input_names=["data"],
    dynamic_axes={
        "data": [0, 1, 2, 3]
    },
    output_names=["output"],
)
```

This is the output of the above code
```
/usr/lib/python3.10/site-packages/torch/onnx/utils.py:1329: UserWarning: No names were found for specified dynamic axes of provided input.Automatically generated names will be applied to each dynamic axes of input data
  warnings.warn("No names were found for specified dynamic axes of provided input."
graph():
  %output : Long(requires_grad=0, device=cpu) = onnx::Constant[value={196}]() # /tmp/bug/bug.py:7:0
  return (%output)

graph(%data : Float(*, *, *, *, strides=[24576, 8192, 128, 1], requires_grad=0, device=cpu)):
  %1 : Long(4, strides=[1], device=cpu) = onnx::Shape(%data) # /tmp/bug/bug.py:14:0
  %2 : Long(device=cpu) = onnx::Constant[value={0}]() # /tmp/bug/bug.py:14:0
  %3 : Long(device=cpu) = onnx::Gather[axis=0](%1, %2) # /tmp/bug/bug.py:14:0
  %4 : Long(4, strides=[1], device=cpu) = onnx::Shape(%data) # /tmp/bug/bug.py:14:0
  %5 : Long(device=cpu) = onnx::Constant[value={1}]() # /tmp/bug/bug.py:14:0
  %6 : Long(device=cpu) = onnx::Gather[axis=0](%4, %5) # /tmp/bug/bug.py:14:0
  %7 : Long(4, strides=[1], device=cpu) = onnx::Shape(%data) # /tmp/bug/bug.py:14:0
  %8 : Long(device=cpu) = onnx::Constant[value={2}]() # /tmp/bug/bug.py:14:0
  %9 : Long(device=cpu) = onnx::Gather[axis=0](%7, %8) # /tmp/bug/bug.py:14:0
  %10 : Long(4, strides=[1], device=cpu) = onnx::Shape(%data) # /tmp/bug/bug.py:14:0
  %11 : Long(device=cpu) = onnx::Constant[value={3}]() # /tmp/bug/bug.py:14:0
  %12 : Long(device=cpu) = onnx::Gather[axis=0](%10, %11) # /tmp/bug/bug.py:14:0
  %13 : Long(requires_grad=0, device=cpu) = onnx::Constant[value={0}]()
  %14 : Long(requires_grad=0, device=cpu) = onnx::Add(%3, %13) # /tmp/bug/bug.py:16:0
  %15 : Long(requires_grad=0, device=cpu) = onnx::Add(%14, %6) # /tmp/bug/bug.py:16:0
  %16 : Long(requires_grad=0, device=cpu) = onnx::Add(%15, %9) # /tmp/bug/bug.py:16:0
  %output : Long(requires_grad=0, device=cpu) = onnx::Add(%16, %12) # /tmp/bug/bug.py:16:0
  return (%output)
```

As you can see Tensor.data.size() returns a constant node, while Tensor.shape returns the correct onnx.

### Versions

CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Manjaro Linux (x86_64)
GCC version: (GCC) 11.2.0
Clang version: 13.0.1
CMake version: version 3.22.3
Libc version: glibc-2.35

Python version: 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0] (64-bit runtime)
Python platform: Linux-5.15.28-1-MANJARO-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.6.112
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1060 6GB
Nvidia driver version: 510.54
cuDNN version: Probably one of the following:
/usr/lib/libcudnn.so.8.3.2
/usr/lib/libcudnn_adv_infer.so.8.3.2
/usr/lib/libcudnn_adv_train.so.8.3.2
/usr/lib/libcudnn_cnn_infer.so.8.3.2
/usr/lib/libcudnn_cnn_train.so.8.3.2
/usr/lib/libcudnn_ops_infer.so.8.3.2
/usr/lib/libcudnn_ops_train.so.8.3.2
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.3
[pip3] torch==1.11.0rc5
[pip3] torchvision==0.12.0a0+b3c8b20