Repository: pytorch
Issue: UserWarning: operator() sees varying value in profiling
Labels: oncall: jit

### 🐛 Describe the bug

Hello, I have a problem with the following code, causing a warning when executed with `torch.jit.script`. The code seems to work ok, I just find that the warning is a bit weird.

This is a minimal example to reproduce the bug.

```python
from typing import Dict

import torch
import torch.nn as nn
from torch import Tensor


class MyModule(nn.Module):
    def forward(self, x: Tensor) -> Tensor:
        x = x.permute(0, 2, 3, 1).contiguous()
        x = x.view(x.size(0), -1, x.size(3))
        return x


class AnotherModule(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self._my_module = MyModule()

    def forward(self, x: Dict[str, Tensor]) -> Dict[str, Tensor]:
        return {key: self._my_module(x[key]) for key in x}


if __name__ == "__main__":
    model = AnotherModule()
    model: AnotherModule = torch.jit.script(model)  # type: ignore
    out = model(
        {
            "a": torch.rand(1, 5, 32, 32),
            "b": torch.rand(1, 3, 32, 32),
            "c": torch.rand(1, 5, 32, 32),
        }
    )
    print({k: v.shape for k, v in out.items()})
```

Spefically, I get this warning:
``` 
/home/luca/venvs/dev38/lib/python3.8/site-packages/torch/nn/modules/module.py:1130: UserWarning: operator() sees varying value in profiling, ignoring and this should be handled by GUARD logic (Triggered internally at ../torch/csrc/jit/codegen/cuda/parser.cpp:3513.)
return forward_call(*input, **kwargs)
```

Some insight on the bug:

- The warning appears only when using `torch.jit.script`: if I comment the line in which jit compilation is called everything works fine.
- It seems to be caused by the forward method of `MyModule`, if I uncomment at least one line of the `forward` method, no warning is raised. 
- It also has interactions with the second dimension of input tensors in the dictionary with keys "a", "b" and "c". If they have the same number of channes, no warning is raised. 👀 
- I cannot reproduce this with previous versions of PyTorch. 

Another question: is it safe to ignore this kind of warning?

### Versions

PyTorch version: 1.12.0+cu116
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.4 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.8.10 (default, Jun 22 2022, 20:18:18)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-41-generic-x86_64-with-glibc2.29
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 2080 Ti
Nvidia driver version: 510.47.03
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.23.1
[pip3] pytorch-lightning==1.6.5
[pip3] torch==1.12.0+cu116
[pip3] torchmetrics==0.9.3
[pip3] torchvision==0.13.0+cu116
[conda] Could not collect