GradResult
On this page

GradResult

Interface in IR

What grad returns: the module with the derivative function added, and its name.

import type { GradResult } from 'typeshade'

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

Syntax

interface GradResult {
readonly module: ModuleDecl;
readonly name: string;
readonly adjoints?: Readonly<Record<string, string>>;
readonly tapeBytes?: number;
}

Instance properties

moduleread only ModuleDecl

The input module plus the derivative function and the helpers it calls.

nameread only string

The name of the derivative function in GradResult.module.

adjointsoptionalread only Readonly<Record<string, string>>

Reverse mode only: for each name of wrt, the field of the returned struct that holds its adjoint.

tapeBytesoptionalread only number

Reverse mode only: the bytes of function memory the derivative’s tape takes in one invocation, its tape slots, branch records, loop counters and checkpoint slots, with the deepest chain of helpers it calls. No other memory is allocated for it.

See also

Source

src/core/passes/grad.ts, line 41, at commit af54ddad5

Edit this page Report a problem