Repository: pytorch
Issue: Stft changes number of times when with center=False and n_fft > win_length
Labels: triaged,module: fft,module: scipy compatibility

### 🐛 Describe the bug

I am implimenting a stft library that uses torch under the hood but uses the parameter conventions of scipy’s ShortTimeFFT. I am having trouble understanding the torch behavior when the stft fft is zero padded and center=False. I believe the behavior is a bug, but I can change this bug report to a documentation ticket if the behavior is expected. However, I don't know where to look for the defined behavior.

My basic expectation is zero padding should only change the frequency axis of the output, but the time axis should not change because the data sampling (window and hop) has remained the same. When center=True this holds, but doesn’t when center=False.

```
timeseries = torch.randn((8, 2300))

# True, which I expect
torch.stft(timeseries, 200, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True).shape[2] == torch.stft(timeseries, 400, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True).shape[2]

# False, which I think is a bug
torch.stft(timeseries, 200, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True, center=False).shape[2] == torch.stft(timeseries, 400, hop_length=100, win_length=200, window=torch.ones(200), return_complex=True, center=False).shape[2]
```

### Versions

PyTorch version: 2.0.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 12 (bookworm) (x86_64)
GCC version: (Debian 12.2.0-14) 12.2.0
Clang version: 18.1.8 (++20240731024826+3b5b5c1ec4a3-1~exp1~20240731144843.145)
CMake version: version 3.31.1
Libc version: glibc-2.36

Python version: 3.11.7 (main, Dec 19 2023, 03:30:20) [GCC 12.2.0] (64-bit runtime)
Python platform: Linux-6.8.0-1019-aws-x86_64-with-glibc2.36
Is CUDA available: True
CUDA runtime version: 11.8.89
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA A10G
Nvidia driver version: 550.120
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.6.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.6.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        48 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               16
On-line CPU(s) list:                  0-15
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 7R32
CPU family:                           23
Model:                                49
Thread(s) per core:                   2
Core(s) per socket:                   8
Socket(s):                            1
Stepping:                             0
BogoMIPS:                             5599.85
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch topoext ssbd ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr rdpru wbnoinvd arat npt nrip_save rdpid
Hypervisor vendor:                    KVM
Virtualization type:                  full
L1d cache:                            256 KiB (8 instances)
L1i cache:                            256 KiB (8 instances)
L2 cache:                             4 MiB (8 instances)
L3 cache:                             32 MiB (2 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-15
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; untrained return thunk; SMT enabled with STIBP protection
Vulnerability Spec rstack overflow:   Vulnerable: Safe RET, no microcode
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Retpolines; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] mypy-boto3-ec2==1.28.85
[pip3] mypy-boto3-s3==1.28.55
[pip3] mypy-boto3-sagemaker==1.28.76
[pip3] mypy-boto3-secretsmanager==1.35.0
[pip3] mypy-boto3-sns==1.28.72
[pip3] mypy-boto3-sqs==1.28.82
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] numpy-stl==3.1.1
[pip3] onnx==1.15.0
[pip3] onnx-graphsurgeon==0.3.15
[pip3] onnxruntime==1.16.3
[pip3] pytorch-lightning==2.1.0
[pip3] pytorch-quantization==2.1.2
[pip3] torch==2.0.0+cu118
[pip3] torch-tb-profiler==0.4.3
[pip3] torchaudio==2.0.1+cu118
[pip3] torchdata==0.6.0
[pip3] torchmetrics==1.1.0
[pip3] torchtext==0.15.1+cpu
[pip3] torchvision==0.15.1+cu118
[pip3] triton==2.0.0
[conda] Could not collect


cc @mruberry