Skip to main content

Module keys

Module keys 

Source
Expand description

Reserved keys in a run’s output store.

A run threads node outputs through one HashMap<String, Value>, and a few entries in it are not node outputs: the graph’s input, a specific node’s input, and the state a trainable node learned. They are distinguished by a __ prefix.

The prefixes used to be spelled inline — written with format! in the runner and read back with strip_prefix in three different crates. This module is the only place that knows how the key is spelled, so a change to it cannot leave one reader behind.

The prefix is a convention, not a guarantee: a node whose id is literally __state_x would collide. is_reserved is what a caller uses to keep these out of a list of node outputs.

Constants§

GRAPH_INPUT
The graph’s own input, available to every root node.

Functions§

input_key
Where the input handed to node_id is stored.
is_input_key
Does this key hold an input rather than an output or a state?
is_reserved
Is this key one of the run’s own entries rather than a node’s output?
node_of_state_key
The node whose state this key holds, or None if it is not a state key.
state_key
Where the state fitted for node_id is stored.