Skip to content

A point-free implementation of a one-layer transformer in Coconut.

License

Notifications You must be signed in to change notification settings

evhub/point-free-transformer

Repository files navigation

point-free-transformer

A point-free implementation of a one-layer transformer in Coconut.

See the full highlighted source here.

Some help for those that don't read Coconut:

  • ..> is forward function composition (so f ..> g is g . f in Haskell)
  • f$(<args>) is partial application (so f$(<args>) is functools.partial(f, <args>) in Python)
  • lift “lifts” a function so that all of its arguments become unary functions (for a binary function, lift is the S' combinator, or liftA2 in Haskell—e.g. lift(f)(g, h) is equivalent to lambda x: f(g(x), h(x)) in Python)
  • (<op>) is the operator function for <op> (so (+) is operator.add in Python)
  • (. <op> <arg>) is equivalent to <op>$(?, <arg>) (? is a placeholder that means that argument isn't partially applied)
  • .method(<args>) is equivalent to lambda x: x.method(<args>) in Python

Also, einsum here is better_einsum.einsum.

About

A point-free implementation of a one-layer transformer in Coconut.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published