oneflow
oneflow copied to clipboard
[bug][nn.Graph] stft with registered window and pad_mode='reflect' crashes in Graph mode ("This is a oneflow bug")
Summary
Calling oneflow.stft inside nn.Graph with a registered window buffer and pad_mode='reflect' fails during graph build with a generic:
RuntimeError: This is a oneflow bug, please submit an issue...
In eager mode this call works, but in Graph mode it crashes with the generic internal error, offering no actionable message.
Code to reproduce bug
import oneflow as flow
import oneflow.nn as nn
class M(nn.Module):
def __init__(self):
super().__init__()
self.n_fft = 256
self.hop_length = 128
self.register_buffer("window", flow.hann_window(self.n_fft, dtype=flow.float32))
self.pad_mode = "reflect" # <- triggers the failing path in Graph
def forward(self, x):
return flow.stft(
x,
n_fft=self.n_fft,
hop_length=self.hop_length,
window=self.window,
return_complex=False,
pad_mode=self.pad_mode,
)
class G(nn.Graph):
def __init__(self, m): super().__init__(); self.m = m
def build(self, x): return self.m(x)
x = flow.randn(1, 1024)
g = G(M())
g(x) # -> RuntimeError: "This is a oneflow bug..."
Output
...
result = unbound_forward_of_module_instance(self, *args, **kwargs)
return flow.stft(...)
RuntimeError: Error: RuntimeError : This is a oneflow bug, please submit an issue at 'https://github.com/Oneflow-Inc/oneflow/issues' ...
System Information
- OS: Ubuntu 22.04.4 LTS (x86_64)
- OneFlow version : 1.0.0.dev20250921+cpu
- Python version: 3.10.16