tfjs-special
v1.0.0
Published
Implements Beta, Gamma, Zeta, and Bessel functions for TensorFlow.js
Downloads
9
Readme
TensorFlow.js Special Math
TensorFlow.js Special Math implements all the special math functions from TensorFlow, those are the Gamma, Beta, Bessel, and Error functions, as well as all the variations that TensorFlow provides.
These functions are essential in properbility distributions and for solving partial differential equations, and may other advanced mathmatical fields.
All the functions are:
- implemented in both WebGL and JavaScript.
- have defined gradients and supports tf.grad().
- are TypeScript compatible with TensorFlow.js.
- transpiled from cephes, the same library used by SciPy.
Example
const tfc = require('@tensorflow/tfjs-core');
const tfs = require('tfjs-special');
const x = tfc.tensor1d([1, 2, 3, 4]);
const gamma = (tensor) => tfs.lgamma(tensor).exp();
const gammadx = tfc.grad(gamma);
gammadx(x).print();