GradCheckOptions
On this page

GradCheckOptions

Interface in IR

Options for gradCheck.

import type { GradCheckOptions } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

interface GradCheckOptions {
readonly wrt: string | readonly string[];
readonly at: readonly (readonly unknown[])[];
readonly mode?: 'forward' | 'reverse';
readonly custom?: Readonly<Record<string, string>>;
readonly h?: number;
readonly tolerance?: number;
}

Instance properties

wrtread only string | readonly string[]

The parameters to check the derivative with respect to: one name or a list. Each is an f32 or an f32 vector, and in reverse mode also an f32 matrix.

atread only readonly (readonly unknown[])[]

The points: each is the argument list of one call of the function, in its order, with a vector or a matrix as an array of numbers.

modeoptionalread only 'forward' | 'reverse'

The mode of the derivative under check. Defaults to 'forward'.

customoptionalread only Readonly<Record<string, string>>

Reverse mode: the author-written adjoints to hold, as custom of grad’s options.

hoptionalread only number

The step of the central difference. Defaults to 1e-5.

toleranceoptionalread only number

The relative tolerance: a partial derivative passes when it is within tolerance * max(1, |difference|) of the central difference. Defaults to 1e-4.

See also

Source

src/core/passes/grad-check.ts, line 15, at commit af54ddad5

Edit this page Report a problem