Compare commits

...

1 Commits

Author SHA1 Message Date
2a0065d54e Fix: list index out of range with softmax when using 0 dim 2025-10-31 19:50:54 +05:30
2 changed files with 12 additions and 0 deletions

View File

@ -3274,6 +3274,15 @@ class CPUReproTests(TestCase):
metrics.reset()
self.common(fn, (x,))
def test_softmax_with_zero_dim(self):
def fn(x):
x = torch.softmax(x, 0)
return x
x = torch.rand([], dtype=torch.bfloat16)
metrics.reset()
self.common(fn, (x,))
@config.patch({"fx_graph_cache": False, "fx_graph_remote_cache": False})
def test_local_buffer_in_outer_loop_fusion(self):
def fn(x):

View File

@ -892,6 +892,9 @@ def _other_is_broadcasted_in_dim(match):
if isinstance(dim, int):
dim = (dim,)
if any(d >= len(other_shape) for d in dim):
return False
return all(statically_known_true(other_shape[d] == 1) for d in dim)