Skip to content

Commit

Permalink
WIP: fix numpy while loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Cattaneo committed Oct 28, 2024
1 parent 1a8aab8 commit 4dadcf4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/gt4py/cartesian/gtc/numpy/oir_to_npir.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,12 @@ def visit_AssignStmt(
def visit_While(
self, node: oir.While, *, mask: Optional[npir.Expr] = None, **kwargs: Any
) -> npir.While:
cond = self.visit(node.cond, mask=mask, **kwargs)
cond_expr = self.visit(node.cond, **kwargs)
if mask:
mask = npir.VectorLogic(op=common.LogicalOperator.AND, left=mask, right=cond)
else:
mask = cond
cond_expr = npir.VectorLogic(op=common.LogicalOperator.AND, left=mask, right=cond_expr)

return npir.While(
cond=cond, body=utils.flatten_list(self.visit(node.body, mask=mask, **kwargs))
cond=cond_expr, body=utils.flatten_list(self.visit(node.body, mask=cond_expr, **kwargs))
)

def visit_HorizontalRestriction(
Expand Down

0 comments on commit 4dadcf4

Please sign in to comment.