Skip to content

Commit a342033

Browse files
fix(export_torch): drop redundant dim check after selection
1 parent 78dfc8c commit a342033

2 files changed

Lines changed: 0 additions & 13 deletions

File tree

pysr/export_torch.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ def forward(self, X):
187187
if self._selection is not None:
188188
X = X[:, self._selection]
189189

190-
if X.dim() != 2:
191-
raise ValueError(
192-
"Expected a 2D input tensor `X` with shape (L, nfeatures)."
193-
)
194-
195190
preserve_2d_output = X.shape[1] == 1
196191
symbols = {
197192
symbol: X[:, i : i + 1] for i, symbol in enumerate(self.symbols_in)

pysr/test/test_torch.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,6 @@ def test_issue_571_selection_list_keeps_2d(self):
256256
out = m(X)
257257
self.assertEqual(tuple(out.shape), (32, 1))
258258

259-
def test_issue_571_reject_int_selection(self):
260-
"""Issue #571: selection that collapses to 1D should raise (selection=0)."""
261-
x = sympy.symbols("x")
262-
m = sympy2torch(x + 1, [x], selection=0)
263-
X = self.torch.randn(32, 2)
264-
with self.assertRaises(ValueError):
265-
m(X)
266-
267259
def test_constant_arguments(self):
268260
# Test that functions with constant arguments work correctly
269261
# Regression test for https://github.com/MilesCranmer/PySR/issues/656

0 commit comments

Comments
 (0)