Skip to content

splitValueAndGrad

splitValueAndGrad(vg): object

Defined in: api.js:275

Split any (x) => { value, gradient } function into the separate value and gradient functions a (fn, gradFn) API takes, sharing one evaluation between them exactly as valueAndGradFns does. For a function that already exists, such as one rebuilt by compileFromJSON.

Parameters

vg

(x) => object

Returns

object

gradient

gradient: (x) => any

Parameters

x

any

Returns

any

value

value: (x) => number

Parameters

x

any

Returns

number