-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Porting runtime to the web #336
Conversation
…ate decoder; trying unit tests
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Some more types here. After manually encoding In addition to the array encoding of sum type data, the generated types also contain these generics that we don't really need. This will depend a little on tfjs's preferred number encoding, but I'll probably cast everything to type Translation<T> = ITrans<T>;
interface ITrans<T> {
trMap: Map<Name, Map<string, FieldExpr<T>>>;
warnings: string[];
}
type FieldExpr<T> = IFExpr<T> | IFGPI<T>;
interface IFExpr<T> {
tag: "FExpr";
contents: TagExpr<T>;
}
interface IFGPI<T> {
tag: "FGPI";
contents: [string, Map<string, TagExpr<T>>];
}
type TagExpr<T> = IOptEval<T> | IDone<T> | IPending<T>;
interface IOptEval<T> {
tag: "OptEval";
contents: Expr;
}
interface IDone<T> {
tag: "Done";
contents: Value<T>;
}
interface IPending<T> {
tag: "Pending";
contents: Value<T>;
} |
…pedoc support; change Name type to plain string in the backend
Turns out that decoding serialized JSON |
@strout18 I added a temp SVG path here for you to use on completing the
(The path is hardcoded in Things to finish:
BTW @wodeni where would be the right place to convert |
…s and types to be on autodiff types only (in this case, Tensors). remove autodiff=true flag from evaluator. convert to and from the `number` type for display. factor out computations into a separate file, and convert their types to be autodiff as well
Change "engine" to run on autodiff types only
… but resample still doesn't work for the same reason; fix frontend -> backend JSON (translation conversion); add @keenancrane's hyperbolic `tangentTo` constraint
…bra-domain/twoVectorsPerp.sub linear-algebra-domain/linear-algebra-paper-simple.sty linear-algebra-domain/linear-algebra.dsl`
… with L-BFGS; remove tf.js as dependency; port several examples (including large ones from the paper) to work with new autodiff
Add custom autodiff, energy/gradient compilation, and solver in web-runtime
Description
Related issues: none
This PR will eventually contain a web runtime for Penrose. Short-term goals include:
State
, decode it into some data structure with type, and evaluate the translation in the state. Top level functionevalTranslation(s : State) : Shapes
Longer-term goals:
See additional documentation on this wiki page.
Implementation strategy and design decisions
npm install
.fsevents
related errors, trybrew install watchman
, which did the trick for me on Mac OS X CatalinaExamples with steps to reproduce them
stack install && tsdef > types.d.ts
npm test
inreact-renderer
Checklist
stack test
Open questions
Questions that require more discussion or to be addressed in future development:
Backend runtime related
ArgVal
seems convenient for differentiating betweenGPI
andVal
, I think it's cleaner if we just treat it as an expression since the GPI values can just be treated as yet another data structure similar to lists. Obviously a few things to consider: