Skip to main content

Flax-like computed parameters for bare JAX

Project description

Parametrix logo

flax.nnx.Param-like computed parameters for bare JAX (and Equinox).

Documentation CI Codecov Ruff ty uv Publish PyPI PyPI - Python Version

Installation

pip install parametrix

Example

The following example shows how to use Param as a base class for a parameter class that enforces positivity:

import jax.numpy as jnp
from parametrix import Param

class PositiveOnlyParam(Param):
    def __init__(self, value):
        super().__init__(jnp.log(value))

    @property
    def value(self):
        return jnp.exp(self.raw_value)

The backing values of Params are always stored as jax.Arrays, meaning that they will automatically be picked up as learnable parameters by libraries like Equinox.

Param objects also behave like numeric types, so that they are able to be used within models and any other functions without having to make any changes to the code.

Documentation

API documentation is available at Read the Docs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parametrix-0.1.3.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parametrix-0.1.3-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file parametrix-0.1.3.tar.gz.

File metadata

  • Download URL: parametrix-0.1.3.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.24

File hashes

Hashes for parametrix-0.1.3.tar.gz
Algorithm Hash digest
SHA256 11cb16d9fa322474d32515c3cf27ab5a0471b2aa40c0ebb0f0da31557ea26bb0
MD5 c99128efb7b185ed23fba3b8af65acd6
BLAKE2b-256 f4b70a1674ab5202c7e007b74851e460e74596ac22c1d51678887ea207929c6f

See more details on using hashes here.

File details

Details for the file parametrix-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: parametrix-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.24

File hashes

Hashes for parametrix-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ec63d533f5b836953c500d31133e6f149d74b810e0c945a94e2068974e6bcd5a
MD5 27860b366cfe366248195558802a284d
BLAKE2b-256 d796b503349bf1cda601e4a7412ec0e89000f7ecf7dca0b0a93e2121f34ed7e8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page