Repository: pytorch
Issue: AT_ASSERT fail with DataLoaderOptions().drop_last()
Labels: module: dataloader,triaged,Stale

### 🐛 Describe the bug

When I enable DataLoaderOptions().drop_last() for my DataLoader, I get the following error:
```
erminate called after throwing an instance of 'c10::Error'
  what():  indices->size() > 0INTERNAL ASSERT FAILED at "external/torch/include/torch/csrc/api/include/torch/data/dataloader/stateless.h":75, please report a bug to PyTorch. 
Exception raised from get_batch_request at external/torch/include/torch/csrc/api/include/torch/data/dataloader/stateless.h:75 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x6b (0x7f5870ccc70b in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/../../_solib_k8/_U@torch_S_S_Ctorch___Ulib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, char const*) + 0xd1 (0x7f5870cc8571 in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/../../_solib_k8/_U@torch_S_S_Ctorch___Ulib/libc10.so)
frame #2: <unknown function> + 0x3c59f (0x55bd4df3659f in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/train_eval_main)
frame #3: <unknown function> + 0x3c9d1 (0x55bd4df369d1 in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/train_eval_main)
frame #4: <unknown function> + 0x2f07c (0x55bd4df2907c in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/train_eval_main)
frame #5: __libc_start_main + 0xf3 (0x7f57750570b3 in /lib/x86_64-linux-gnu/libc.so.6)
frame #6: <unknown function> + 0x3229e (0x55bd4df2c29e in /home/jackshi/.cache/bazel/_bazel_jackshi/4a89d112b3c148d7ca126b76366ffd5e/execroot/jackshi3/bazel-out/k8-opt/bin/northern_lights/train_eval_main/train_eval_main)
```

When I don't have that option enabled, I can get a batch out no problem. This flag breaks this assert.

### Versions

PyTorch version: 1.10.0+cu102
Is debug build: False
CUDA used to build PyTorch: 10.2
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.2 LTS (x86_64)
GCC version: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.8.10 (default, Nov 26 2021, 20:14:08)  [GCC 9.3.0] (64-bit runtime)
Python platform: Linux-5.11.0-43-generic-x86_64-with-glibc2.29
Is CUDA available: True
CUDA runtime version: Could not collect
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1070
Nvidia driver version: 470.86
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] torch==1.10.0
[pip3] torchaudio==0.10.0
[pip3] torchmetrics==0.6.1
[pip3] torchvision==0.11.1


cc @SsnL @VitalyFedyunin @ejguan @NivekT