Skip to content

Commit

Permalink
.wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardoV94 committed Aug 13, 2024
1 parent 756170b commit 79d5600
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions pytensor/tensor/elemwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,7 @@ def _c_all(self, node, name, input_names, output_names, sub):

def c_code(self, node, name, inames, onames, sub):
code = "\n".join(self._c_all(node, name, inames, onames, sub))
print(code)
return code

def c_headers(self, **kwargs):
Expand Down
31 changes: 17 additions & 14 deletions tests/tensor/test_elemwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,21 +400,21 @@ def test_same_inputs(self):
class TestCAReduce(unittest_tools.InferShapeTester):
op = CAReduce
cases = [
((5, 6), None),
((5, 6), (0, 1)),
((5, 6), (0,)),
((5, 6), (1,)),
# ((5, 6), None),
# ((5, 6), (0, 1)),
# ((5, 6), (0,)),
# ((5, 6), (1,)),
((5, 6), (-1,)),
((5, 6), (-2,)),
((5, 6), ()),
((2, 3, 4, 5), (0, 1, 3)),
((2, 3, 4, 5), (-2, -3)),
((5, 0), None),
((5, 0), (0,)),
# ((5, 6), (-2,)),
# ((5, 6), ()),
# ((2, 3, 4, 5), (0, 1, 3)),
# ((2, 3, 4, 5), (-2, -3)),
# ((5, 0), None),
# ((5, 0), (0,)),
((5, 0), (1,)),
((5, 0), ()),
((), None),
((), ()),
# ((5, 0), ()),
# ((), None),
# ((), ()),
]
type = TensorType

Expand All @@ -427,7 +427,8 @@ def with_mode(
test_nan=False,
tensor_op=None,
):
for xsh, tosum in self.cases:
for i, (xsh, tosum) in enumerate(self.cases):
print(i, xsh, tosum)
if dtype == "floatX":
dtype = pytensor.config.floatX
x = self.type(
Expand Down Expand Up @@ -530,7 +531,9 @@ def with_mode(
else:
f_xv = f(xv)
assert f_xv.shape == zv.shape, (f_xv, zv)
print(xv, f_xv, zv)
utt.assert_allclose(zv, f_xv)
continue

x = self.type(
dtype, shape=tuple(entry if entry == 1 else None for entry in xsh)
Expand Down

0 comments on commit 79d5600

Please sign in to comment.