-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
106 additions
and
1,294 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v3 | ||
- run: make all | ||
- name: Publish npm packages | ||
run: npm publish --workspaces | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,46 @@ | ||
<div align="center"><img height="256" src="https://github.com/rose-lang/rose-icons/raw/efcc218832d65970a47bed597ee11cecd3d1cc3c/svg/encircled-rose.svg" /></div> | ||
<h1 align="center">Rose</h1> | ||
<p align="center"><em><a href="https://github.com/rose-lang/rose-icons">icon</a> by <a href="https://github.com/aatxe">Aaron Weiss</a> / <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a></em></p> | ||
<p align="center"><a href="https://www.npmjs.com/package/rose"><img src="https://img.shields.io/npm/v/rose" alt="npm" /></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/rose-lang/rose" alt="license" /></a> <a href="https://github.com/rose-lang/rose/actions/workflows/build.yml"><img src="https://github.com/rose-lang/rose/actions/workflows/build.yml/badge.svg" alt="Build" /></a></p> | ||
|
||
Rose is an automatic differentiation engine for the web, inspired by [JAX][]. | ||
|
||
## Installation | ||
|
||
With npm: | ||
|
||
```sh | ||
npm i rose | ||
``` | ||
|
||
With Yarn: | ||
|
||
```sh | ||
yarn add rose | ||
``` | ||
|
||
## Usage | ||
|
||
This example computes the output and gradient of a simple function that | ||
multiplies together the two components of a vector: | ||
|
||
```ts | ||
import { Real, Vec, fn, interp, mul, vjp } from "rose"; | ||
|
||
const f = fn([Vec(2, Real)], Real, (v) => mul(v[0], v[1])); | ||
|
||
const g = fn([Real, Real], Vec(3, Real), (x, y) => { | ||
const { ret, grad } = vjp(f)([x, y]); | ||
const v = grad(1); | ||
return [ret, v[0], v[1]]; | ||
}); | ||
|
||
console.log(interp(g)(2, 3)); // [6, 3, 2] | ||
``` | ||
|
||
## Contributing | ||
|
||
See [`CONTRIBUTING.md`](CONTRIBUTING.md) | ||
See [`CONTRIBUTING.md`][]. | ||
|
||
[`CONTRIBUTING.md`]: https://github.com/rose-lang/rose/blob/main/CONTRIBUTING.md | ||
[JAX]: http://jax.readthedocs.io/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rose-autodiff" | ||
version = "0.0.0" | ||
version = "0.2.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
[package] | ||
name = "rose" | ||
version = "0.0.0" | ||
version = "0.2.0" | ||
publish = false | ||
edition = "2021" | ||
description = "Extensible interactive autodiff." | ||
license = "MIT" | ||
include = ["src/lib.rs"] | ||
|
||
[dependencies] | ||
enumset = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rose-interp" | ||
version = "0.0.0" | ||
version = "0.2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rose-web" | ||
version = "0.0.0" | ||
version = "0.2.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
|
Oops, something went wrong.