MonotonicSplines.jl

This package provides a high-performance, GPU- and AD-friendly implementation of monotonic spline functions in Julia.

The intended use cases is as a building block in Normalizing FLows, resp. parameter transformations in general.

This package currently includes the monotonic rational quadratic splines as defined in "Neural Spline Flows, Durkan et al. 2019".

MonotonicSplines currently implements rational quadratic splines as decribed in "Neural Spline Flows, Durkan et al. 2019".

The splines defined here support the ChangesOfVariables, InverseFunctions and Functors APIs. The splines also come with some custom ChainRulesCore rrule methods to speed up automatic differentiation.

The package uses KernelAbstractions to provide both GPU and multi-vendor GPU support.

Quickstart

using MonotonicSplines, Plots, InverseFunctions, ChangesOfVariables

f = rand(RQSpline)
f.pX, f.pY, f.dYdX

plot(f, xlims = (-6, 6)); plot!(inverse(f), xlims = (-6, 6))

x = 1.2
y = f(x)
with_logabsdet_jacobian(f, x)
inverse(f)(y)
with_logabsdet_jacobian(inverse(f), y)

Table of contents