---
title: "GradCheckOptions: interface in IR, TypeShade API reference"
description: "GradCheckOptions, an interface in IR. Options for gradCheck. The intermediate representation every backend reads: nodes, statements and declarations."
url: https://typeshade.dev/api/gradcheckoptions/
language: en
---

# `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

```ts
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

**`wrt` read 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.

**`at` read 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.

**`mode` optional read only `'forward' | 'reverse'`**

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

**`custom` optional read only `Readonly<Record<string, string>>`**

Reverse mode: the author-written adjoints to hold, as `custom` of [`grad`](https://typeshade.dev/api/grad/)’s options.

**`h` optional read only `number`**

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

**`tolerance` optional read 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

- [`gradCheck`](https://typeshade.dev/api/gradcheck/)
- [`grad`](https://typeshade.dev/api/grad/)

## Source

[`src/core/passes/grad-check.ts`, line 15](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/passes/grad-check.ts#L15), at commit af54ddad5
