BSD-3-Clause licensed by Justin Le
Maintained by [email protected]
This version can be pinned in stack with:hmatrix-backprop-,2245

Module documentation for


hmatrix-backprop on Hackage Build Status

hmatrix operations lifted for backprop.

Meant to act as a drop-in replacement to the API of Numeric.LinearAlgebra.Static. Just change your imports, and your functions are automatically backpropagatable. Useful types are all re-exported.

Formulas for gradients come from the following papers:

Some functions are not yet implemented! See module documentation for details. PR’s definitely appreciated :)


Currently numeric tests are implemented as property tests using hedgehog, but it is possible that the answers might differ from the true values by an amount undetectable by property tests.

All functions currently are tested except for the higher-order functions.

They are tested by “nudging” components of inputs and checking if the change in the function outputs match what is expected from the backpropagated gradient.


Apart from the exact API of hmatrix, it’d be nice to have:

  1. Statically sized convolutions. Should probably add this to hmatrix instead first, though.




Mar 30, 2018

  • zipWithVector family rewritten in the same way as dvmap/dvmap were for version, which is a breaking API change. However, again, it is unlikely that any code using the previous versions compiled at all, so in practicality, no actual code that previously worked is now breaking.


Mar 25, 2018

  • dvmap/dmmap family rewritten, which is a breaking API change. Previous version of dvmap/dmmap would not even compile at all if used, though, because of nonsensical constraints, so it is likely that no code that previously worked is now breaking.
  • backprop types re-exported for convenience


  • Rewrote much code to use isoVar instead of opIso, for increased clarity and cleanliness. Requires backprop-


Feb 10, 2018

  • Initial release