Function

class madspace.Function

Bases: pybind11_object

An immutable compute graph produced by FunctionBuilder.

A function has named inputs and outputs, a list of intermediate locals, named globals for trainable or externally supplied tensors, and the ordered list of InstructionCall that computes the outputs from the inputs. Run one with a FunctionRuntime, or save it to disk and load it back.

property globals

trainable parameters and external inputs.

Type:

Named global tensors

property inputs

Named graph inputs.

property instructions

The instruction calls in execution order.

static load(file: str) → madspace._madspace_py.Function

Load a function previously written by save.

property locals

Intermediate values, one per instruction output.

property outputs

Named graph outputs.

release_inputs()
save(self: madspace._madspace_py.Function, file: str) → None

Serialize the function to file.