Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 2.01 KB

README.md

File metadata and controls

53 lines (41 loc) · 2.01 KB

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();

Install

npm install tfjs-special

Documentation