Repository: pytorch
Issue: linalg.lstsq INTERNAL ASSERT FAILED
Labels: triaged,module: mkl,module: linear algebra,Stale

### 🐛 Describe the bug

Just paying my dues reporting this as requested.

Please note I couldn't reproduce this bug: running the same code had no problems the next time.

```python
p = torch.linalg.lstsq(x, y)
```

x had a shape (1024, 32, 2)
y had a shape (1024, 32, 1)

```
Intel MKL ERROR: Parameter 6 was incorrect on entry to DGELSY.

Traceback (most recent call last):                   
    ...
    p = torch.linalg.lstsq(x, y)
RuntimeError: falseINTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1637395759165/work/aten/src/ATen/native/LinearAlgebraUtils.h":252, please report a bug to PyTorch. torch.linalg.lstsq: (Batch element 0): Argument 6 has illegal value. Most certainly there is a bug in the implementation calling the backend library.```

### Versions

PyTorch version: 1.11.0.dev20211120
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 21.10 (x86_64)
GCC version: (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Clang version: 13.0.0-2
CMake version: version 3.21.3
Libc version: glibc-2.34

Python version: 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:46)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.13.0-22-generic-x86_64-with-glibc2.34
Is CUDA available: True
CUDA runtime version: 11.4.48
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1050 Ti
Nvidia driver version: 470.86
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.1.1
HIP runtime version: N/A
MIOpen runtime version: N/A

Versions of relevant libraries:
[pip3] numpy==1.21.4
[pip3] nupic.torch==0.0.1.dev0
[pip3] torch==1.11.0.dev20211120
[pip3] torch-ema==0.2
[pip3] torchaudio==0.11.0.dev20211120
[pip3] torchtext==0.12.0.dev20211120
[pip3] torchvision==0.12.0.dev20211120
[conda] blas                      2.112                       mkl    conda-forge
[conda] blas-devel                3.9.0            12_linux64_mkl    conda-forge
[conda] cudatoolkit               11.3.1               h2bc3f7f_2  
[conda] cudatoolkit-dev           11.4.0           py39h3811e60_2    conda-forge
[conda] libblas                   3.9.0            12_linux64_mkl    conda-forge
[conda] libcblas                  3.9.0            12_linux64_mkl    conda-forge
[conda] liblapack                 3.9.0            12_linux64_mkl    conda-forge
[conda] liblapacke                3.9.0            12_linux64_mkl    conda-forge
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-devel                 2021.4.0           h66538d2_640  
[conda] mkl-include               2021.4.0           h06a4308_640  
[conda] numpy                     1.21.4           py39hdbf815f_0    conda-forge
[conda] nupic-torch               0.0.1.dev0                dev_0    <develop>
[conda] pytorch                   1.11.0.dev20211120 py3.9_cuda11.3_cudnn8.2.0_0    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] torch-ema                 0.2                      pypi_0    pypi
[conda] torchaudio                0.11.0.dev20211120      py39_cu113    pytorch-nightly
[conda] torchtext                 0.12.0.dev20211120            py39    pytorch-nightly
[conda] torchvision               0.12.0.dev20211120      py39_cu113    pytorch-nightly

cc @jianyuh @nikitaved @pearu @mruberry @walterddr @IvanYashchuk @xwang233 @Lezcano