Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for packing assignments in the python frontend #1854

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

phschaad
Copy link
Collaborator

@phschaad phschaad commented Jan 8, 2025

No description provided.

@@ -38,6 +38,38 @@ def test_single_target_parentheses():
assert (b[0] == np.float32(np.pi))


@dace.program
def single_target_tuple(a: dace.float32[1], b: dace.float32[1], c: dace.float32[2]):
c = (a, b)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should not change the contents of c though

@@ -3296,7 +3296,65 @@ def _visit_assign(self, node, node_target, op, dtype=None, is_return=False):
results.extend(self._gettype(node.value))

if len(results) != len(elts):
raise DaceSyntaxError(self, node, 'Function returns %d values but %d provided' % (len(results), len(elts)))
if len(elts) == 1 and len(results) > 1 and isinstance(elts[0], ast.Name):
Copy link
Collaborator

@tbennun tbennun Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have self.visit-ed to get the name from other kinds of expressions (need to take care to visit the rhs once though)

@tbennun
Copy link
Collaborator

tbennun commented Jan 8, 2025

I'm not sure if we want this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants