Skip to main content

grast

Lazy automatic differentiation for Python

Install

Requires python >= 3.10

pip install grast

Usage

Create function R^n -> R

from grast import var

x = var('x')
y = var('y')
z = var('z').freeze()  # do not compute derivative

h = x/y + y**x
f = z * h + 3

Get gradient

df = f.grad()
df_dx = df['x']
df_dy = df['y']

Evaluate with specific arguments

args = dict(x=-3, y=5, z=2)
f(args)
df_dx(args)
df_dy(args)

View in symbolic format

print(str(f))
print(str(df_dx))
print(str(df_dy))

References

  1. F. Krawiec, S. Peyton Jones, N. Krishnaswami, T. Ellis, R. A. Eisenberg, A. Fitzgibbon. 2022. Provably correct, asymptotically efficient, higher-order reverse-mode automatic differentiation. Proc. ACM Program. Lang., 6, POPL (2022), 1–30. https://doi.org/10.1145/3498710

  2. Jerzy Karczmarczuk. 1998. Functional Differentiation of Computer Programs. In Proceedings of the Third ACM SIGPLAN International Conference on Functional Programming (Baltimore, Maryland, USA) (ICFP ’98). Association for Computing Machinery, New York, NY, USA, 195-203. https://doi.org/10.1145/289423.289442

Metadata

Release files for grast 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grast 0.1.2
File Size Uploaded Provenance Actions
grast-0.1.2.tar.gz 11.3 kB Without provenance Details for grast-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for grast 0.1.2
File Interpreter ABI Platform Actions
grast-0.1.2-py3-none-any.whl Python 3 none any Details for grast-0.1.2-py3-none-any.whl

Total release size: 26.1 kB

Release files / grast-0.1.2.tar.gz

Download URL grast-0.1.2.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
34d6fcdb98144aff679cee938fb5547b3b4bd3ea66758cd283fe5fddb4cc8b0c
BLAKE2b-256 checksum
How to use checksums
5aa2f5ce78117a4a1c3c264dcb8057fa03d69f954bed52f477c028e1d4c9e047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.11.3 Darwin/22.1.0

Release files / grast-0.1.2-py3-none-any.whl

Download URL grast-0.1.2-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a264a0627daa3228adfeb8383b0b50e4192874284b3d08b9bd1edbfb5df75dd
BLAKE2b-256 checksum
How to use checksums
868203b97e0660fa8514196ebb458c79f3e918be61bad3803528bf21c22171e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.0 CPython/3.11.3 Darwin/22.1.0

Security for grast 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page