Skip to main content

DiffKt

A Kotlin Library for Automatic Differentiation

Automatic Differentiation with Kotlin

DiffKt is a general-purpose, functional, differentiable programming framework for Kotlin. It can automatically differentiate through functions of tensors, scalars, and user-defined types. It supports forward-mode and reverse-mode differentiation including Jacobian-vector and vector-Jacobian products, which can be composed for higher-order differentiation.

DiffKt also includes an early integration of ShapeTyping, an extensible compiler plugin for ahead-of-time tensor shape verification and inspection. With the ShapeTyping IntelliJ IDE plugin, users can even inspect tensor shapes and see tensor shape errors while in active development.

Functions over Tensors

Multi-dimensional tensor data types have become popular with deep neural networks. They are used in many applications of data science, such as graph analysis and multi-way statistics. DiffKt support automatic differentiation of functions over tensors.

Functions over User Defined Types

DiffKt lets you create your own user defined types and complex data structures for functions, and can provide automatic differentiation of the functions. This is useful for complex simulations or physical systems modeling, where there are objects with multiple variables that can represent different entities in your simulation.