Giter Club home page Giter Club logo

jaxdecompiler's People

Contributors

pierrickpochelu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kotsaloscv

jaxdecompiler's Issues

TypeError when calling python_jaxpr_python

Hello and congrats on starting this interesting project! I encountered this bug while running the following code:

import jax.numpy as jnp
from jax import value_and_grad
import decompiler 

def fun(ra, rb, r0, k):
    rab = ra - rb
    rab = jnp.sqrt(jnp.dot(rab, rab))
    return 0.5 * k * (rab - r0) ** 2

df = value_and_grad(fun)
ra = jnp.ones(3)
rb = 2 * ra
decomp, pycode = decompiler.python_jaxpr_python(df, (ra, rb, 0.5, 20.0), is_python_returned=True)
print(pycode)
Traceback (most recent call last):
  File "JaxDecompiler/my_test.py", line 13, in <module>
    decomp, pycode = decompiler.python_jaxpr_python(df, (ra, rb, r0, k, box), is_python_returned=True)
  File "JaxDecompiler/decompiler.py", line 35, in python_jaxpr_python
    out = from_jaxpr_object_to_python(jaxpr_obj, **kwargs)
  File "JaxDecompiler/decompiler.py", line 22, in from_jaxpr_object_to_python
    return f, (os.linesep).join(python_lines)
TypeError: sequence item 3: expected str instance, list found

I guess a simple fix is to replace

tabbed_python_lines.append(list_of_python_lines)

with

        tabbed_python_lines.extend(list_of_python_lines)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.