tensorscript
tensorscript copied to clipboard
shapechecking neural net DSL using Hindley-Milner type system(compiles to pytorch as proof of concept)
TensorScript
Dependently-typed tensor computation.
Features
- Parametric polymorphism
- Compile time type checking
- Dependently typed tensors
- Multiple targets(Tensorflow, PyTorch, more to come!)
- Pipes operator
Pipes operator
Pipes operator is a syntax sugar for chained function calls inspired by F#, Elixir and R. For example,
x |> lin1 |> leaky_relu(p=0.2) |> sigmoid
compiles to
x = lin1(x)
x = leaky_relu(x, p=0.2)
x = sigmoid(x)
Development
The language is not usable in production or development.
Todo
- [x] implement module pattern matching
- [x] type level computation (resolved tensor dimension)
- [x] BUG: dimension mismatch for mnist example need to create fresh type variables for different static forward functions
- [x] BUG: non-determinism
- [x] BUG: impl Hash, Eq for Type
- [x] set up examples and tests
- [x] set up commandline
- [x] more examples
- [x] better errors in parser
- [ ] code gen: PyTorch
- [ ] add more examples
- [x] lift dim and tsr to top level
- [ ] add dim level computation dim1 * dim1
- [ ] use Linear as L; aliasing
- [ ] add binary ops (+, -, *, /, %)
- [ ] add if else expression
- [ ] add let binding
- [ ] add more tests