Error when trying to export MONAI model to ONNX
Labels: module: onnx, triaged, onnx-needs-info

### 🐛 Describe the bug

When trying to export the SwinUNETR model from [MONAI](https://github.com/Project-MONAI/MONAI/blob/dev/monai/networks/nets/swin_unetr.py), I get the error:
```
RuntimeError: Failed to export an ONNX attribute 'onnx::Gather', since it's not constant, please try to make things (e.g., kernel size) static if possible.
```
In a different issue, I read that this issue might get fixed by changing `x_shape = x.size()` to `x_shape = [int(s) for s in x.size()]` in the problematic code -- I found out that problem manifests at `proj_out()`. Doing this, though, results in a different error:
```
RuntimeError: Unsupported: ONNX export of instance_norm for unknown channel size.
```
Making this change in all places where I find `x_shape = x.size()` results in a floating point exception!

Here is a minimal example demonstrating the issue:

```python
from monai.networks.nets import SwinUNETR    
import torch                                 
                                             
if __name__ == '__main__':                   
                                             
    model = SwinUNETR(img_size=(96, 96, 96), 
                      in_channels=1,         
                      out_channels=5,        
                      feature_size=48,       
                      drop_rate=0.0,         
                      attn_drop_rate=0.0,    
                      dropout_path_rate=0.0, 
                      use_checkpoint=True,   
                      )                      
    inputs = [torch.randn([1,1,96,96,96])]
    input_names = ['input']                          
    output_names = ['output']                        
                                                     
    torch.onnx.export(                               
        model,                                       
        tuple(inputs), 'model.onnx',                 
        verbose=False,                               
        input_names=input_names,                     
        output_names=output_names,                   
        dynamic_axes=None,                           
        opset_version=11,                            
    )                                                
```

### Versions

Collecting environment information...
PyTorch version: 1.12.1.post200      
Is debug build: False                
CUDA used to build PyTorch: 11.2                                                                              
ROCM used to build PyTorch: N/A                                                                               
                                                                                                              
OS: CentOS Linux release 7.9.2009 (Core) (x86_64)                                                             
GCC version: (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)                                                           
Clang version: Could not collect                                                                              
CMake version: version 3.20.4                                                                                 
Libc version: glibc-2.17                                                                                      
                                                                                                              
Python version: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:36:39) [GCC 10.4.0] (64-bit runtime)
Python platform: Linux-3.10.0-1160.36.2.el7.x86_64-x86_64-with-glibc2.17                                      
Is CUDA available: True                                                                                       
CUDA runtime version: 11.1.105                                                                                
GPU models and configuration:                                                                                 
GPU 0: Tesla T4                                                                                               
GPU 1: Tesla T4                                                                                               
GPU 2: Tesla T4                                                                                               
GPU 3: Tesla T4                                                                                               
GPU 4: Tesla T4                                                                                               
                                                                                                              
Nvidia driver version: 510.39.01                                                                              
cuDNN version: Could not collect                                                                              
HIP runtime version: N/A                                                                                      
MIOpen runtime version: N/A                                                                                   
Is XNNPACK available: True                                                                                    
                                                                                                              
Versions of relevant libraries:                                                                               
[pip3] numpy==1.23.2                                                                                          
[pip3] torch==1.12.1.post200                                                                                  
[conda] cudatoolkit               11.7.0              hd8887f6_10                                             
[conda] magma                     2.5.4                h6103c52_2                                             
[conda] mkl                       2022.1.0           h84fe81f_915                                             
[conda] numpy                     1.23.2          py310h53a5b5f_0                                             
[conda] pytorch                   1.12.1          cuda112py310h51fe464_200