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

[math] enable debugging for new style of transformations in BrainPy #392

Merged
merged 7 commits into from
Jun 18, 2023

Conversation

chaoming0625
Copy link
Collaborator

@chaoming0625 chaoming0625 commented Jun 18, 2023

The previous version of brainpy >=2.4.0, <=2.4.1 has a redundant (or event wrong) compilation phases. For example, for the following code:

import brainpy.math as bm


@bm.jit
def f2(a):
  print('f2 ...')
  return a


@bm.jit
def f1(a):
  print('f1 ...')
  return f2(a)


f1(1.)

In brainpy==2.4.1 you will got:

f1 ...
f2 ...
f2 ...
f1 ...

It first evaluates f1, then evaluate f2, then compile f2, finally compiling f1. This is not the correct order.

For this version of brainpy, we got:

f1 ...
f2 ...
f1 ...
f2 ...

It first evaluates f1, then evaluate f2, then compile f1, finally compilef2. This is exactly what we want!

@chaoming0625 chaoming0625 requested a review from ztqakita June 18, 2023 07:15
@ztqakita ztqakita merged commit d4e8da5 into master Jun 18, 2023
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