Skip to content

microjax: like micrograd but following JAX's functional style #101

@chuan97

Description

@chuan97

microjax

Like micrograd, it implements backpropagation (reverse-mode autodiff) over a dynamically built DAG of scalar values and a small neural networks library on top of it.

Unlike micrograd, which is implemented following PyTorch's OOP API, microjax replicates JAX's functional API. In particular, it exposes the transformation microjax.engine.grad. If you have a Python function f that evaluates the mathematical function $f$, then grad(f) is a Python function that evaluates the mathematical function $\nabla f$. That means that grad(f)(x1, ..., xn) represents the value $\nabla f(x_1, \ldots, x_n)$.

In combination with micrograd, microjax could be useful to illustrate the differences between the OOP and functional paradigms. The functional paradigm is characterized by the use of pure functions acting on immutable state, and higher order functions (transformations) that act on pure functions to return new pure functions. These are all apparent in the implementation of microjax, e.g. f -> grad(f).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions