fix torch.cat bug with boxed CPUFallback (#60993)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60993
Fixes https://github.com/pytorch/pytorch/issues/60902
The boxed fallback was written to assume that there was at least one tensor argument, which it used to figure out what device to move the cpu tensors to. That fails with an op like `torch.cat()`, which doesn't have any tensor arguments, but instead has a single `TensorList` argument.
I also added handling to gracefully deal with the case where you have an empty list of tensors - in that case we don't know what device to move everything to, but that doesn't matter because an empty list of tensors implies that we have no tensors to move anyway.
I tested it out though and noticed that `torch.cat(())` doesn't handle empty lists well anyway (erroring out in the dispatcher). I'm not sure that it's a huge issue, and not even sure that we want to fix it (default to CPU? add an extra codegen'd check into every op that only takes TensorList args?) but I'll file a separate bug for that: https://github.com/pytorch/pytorch/issues/60997
I tested it by running the pytorch/xla suite after removing `cat` from `xla_native_functions.yaml`, and confirming that we don't segfault anymore.
Test Plan: Imported from OSS
Reviewed By: asuhan
Differential Revision: D29471577
Pulled By: bdhirsh
fbshipit-source-id: 58c96e8d48d993785b8d15cfa846ec745a34e623