Repository: pytorch
Issue: [bug][nvfuser] Applying nvfuser to the model leads to runtime error
Labels: triaged,module: nvfuser

### 🐛 Describe the bug

```
Traceback (most recent call last):
  File "main.py", line 202, in <module>
    all_metrics = trainer.train(args.steps, args.val_steps, args.save_every, args.eval_every)
  File "/h/zhengboj/SetGan/set-gan/trainer.py", line 127, in train
    d_loss, g_loss, d_aux_losses, g_aux_losses = self.train_step(args_i)
  File "/h/zhengboj/SetGan/set-gan/trainer.py", line 189, in train_step
    d_base_loss_i, d_aux_losses_i = self._discriminator_step(args)
  File "/h/zhengboj/SetGan/set-gan/trainer.py", line 383, in _discriminator_step
    aux_losses[loss_fct.name] = loss_fct(self.discriminator, self.generator, candidate_batch, fake_batch, args, "discriminator", reference_batch)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1111, in _call_impl
    return forward_call(*input, **kwargs)
  File "/h/zhengboj/SetGan/set-gan/training_utils.py", line 204, in forward
    return self._discriminator_loss(discriminator, generator, real_batch, fake_batch, args, *loss_args, **loss_kwargs)
  File "/h/zhengboj/SetGan/set-gan/training_utils.py", line 236, in _discriminator_loss
    scaled_gradients = torch.autograd.grad(outputs=self.scaler.scale(disc_interpolates), inputs=interpolates,
  File "/opt/conda/lib/python3.8/site-packages/torch/autograd/__init__.py", line 275, in grad
    return Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
RuntimeError: 0INTERNAL ASSERT FAILED at "/opt/pytorch/pytorch/torch/csrc/jit/ir/alias_analysis.cpp":602, please report a bug to PyTorch. We don't have an op for aten::cat but it isn't a special case.  Argument types: Tensor, int, 

Candidates:
        aten::cat(Tensor[] tensors, int dim=0) -> (Tensor)
        aten::cat.names(Tensor[] tensors, str dim) -> (Tensor)
        aten::cat.names_out(Tensor[] tensors, str dim, *, Tensor(a!) out) -> (Tensor(a!))
        aten::cat.out(Tensor[] tensors, int dim=0, *, Tensor(a!) out) -> (Tensor(a!))
Generated:
```

I tried to enable nvfuser when training my model but got the above runtime error. I also tried running my code without scripting the model and everything goes fine. It seems that the error is caused by invoking the `torch.cat` operator with a single tensor. However, after checking the source code, I can verify that each `torch.cat` operator is invoked with a list of tensors. Therefore, I am not sure what is causing this issue. Any help is appreciated. Thanks.

### Versions

```
Collecting environment information...
PyTorch version: 1.12.0a0+2c916ef
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) 9.4.0
Clang version: Could not collect
CMake version: version 3.22.3
Libc version: glibc-2.31

Python version: 3.8.12 | packaged by conda-forge | (default, Jan 30 2022, 23:42:07)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.4.0-110-generic-x86_64-with-glibc2.10
Is CUDA available: True
CUDA runtime version: 11.6.112
GPU models and configuration: 
GPU 0: Tesla T4
GPU 1: Tesla T4
GPU 2: Tesla T4
GPU 3: Tesla T4

Nvidia driver version: 470.103.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.3.3
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.3.3
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.22.3
[pip3] pytorch-quantization==2.1.2
[pip3] torch==1.12.0a0+2c916ef
[pip3] torch-tensorrt==1.1.0a0
[pip3] torchtext==0.12.0a0
[pip3] torchvision==0.13.0a0
[conda] magma-cuda110             2.5.2                         5    local
[conda] mkl                       2019.5                      281    conda-forge
[conda] mkl-include               2019.5                      281    conda-forge
[conda] numpy                     1.22.3           py38h05e7239_0    conda-forge
[conda] pytorch-quantization      2.1.2                    pypi_0    pypi
[conda] torch                     1.12.0a0+2c916ef          pypi_0    pypi
[conda] torch-tensorrt            1.1.0a0                  pypi_0    pypi
[conda] torchtext                 0.12.0a0                 pypi_0    pypi
[conda] torchvision               0.13.0a0                 pypi_0    pypi
```

FYI, @wangshangsam