Lazy automatic differentiation for Python
Project description
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
-
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
-
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grast-0.1.2.tar.gz.
File metadata
- Download URL: grast-0.1.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.3 Darwin/22.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34d6fcdb98144aff679cee938fb5547b3b4bd3ea66758cd283fe5fddb4cc8b0c
|
|
| MD5 |
b101d33d3211313aa6c78d7db5337979
|
|
| BLAKE2b-256 |
5aa2f5ce78117a4a1c3c264dcb8057fa03d69f954bed52f477c028e1d4c9e047
|
File details
Details for the file grast-0.1.2-py3-none-any.whl.
File metadata
- Download URL: grast-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.0 CPython/3.11.3 Darwin/22.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a264a0627daa3228adfeb8383b0b50e4192874284b3d08b9bd1edbfb5df75dd
|
|
| MD5 |
a9e16c5d8649f4353b4baa60d6883be8
|
|
| BLAKE2b-256 |
868203b97e0660fa8514196ebb458c79f3e918be61bad3803528bf21c22171e8
|