PennyLaneAI / PennyLaneAI/catalyst

Improve error handling / add type promotion to AutoGraph loops

Open
#354 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
234
Forks
84
Avg merge
2d 15h
Merged PRs (30d)
66

Description

Two issues are uncovered in the referenced discussion:

  • Which errors are raised during a fallback to Python? Sometimes it is clear the user intended to perform an autograph conversion, but the fallback to Python can obscure the error messaging.
  • Can we support type promotion for autograph captured control flow, on pre-initialized variables?

Is type promotion supported here?
I suppose the following code should pass:

def f(pred: bool):
  x = 1
  while pred:
    x = 3.2
return x

Originally posted by @maliasadi in https://github.com/PennyLaneAI/catalyst/pull/352#discussion_r1384077617

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the referenced discussion in PR #352 first, then reproduce the Python loop example and inspect the AutoGraph fallback behavior it describes. Done means the intended conversion produces clear errors and the captured control flow supports the proposed type promotion for pre-initialized variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.