Skip to content

← deep_learning package

CustomInitializer

A custom initializer that is defined by a computational graph that takes in a shape and data type (string) and returns an array of the given shape/type.

An example graph has a Placeholder node with (slot)name "shape" and another one with name "dtype" (matching the signature in the signature parameter), and wires these into the "shape" and "precision" inputs of a RandomNormal node; that node's "This" output is then wired into the "graph" input of the CustomInitializer node (this node). Since the RandomNormal node also needs a random seed, which should derived from the root seed governing the overall neural network computation to ensure reproducibility, it is best practice to obtain that seed from a "Draw Random Seed" node and to check the "from haiku context" option to source it from the neural network-associated random sequence. For Experts: the graph can also define a third positional input (i.e., a placeholder node whose name appears at the end of the signature), which receives a random seed (for more on managing random seeds, see the documentation of the "Create Random Seed" node). Version 0.5.0

Ports/Properties

graph

Generator graph.

  • verbose name: Graph
  • default value: None
  • port type: GraphPort
  • value type: Graph

graph__signature

Signature for the "graph" input. This represents the signature for the subgraph that is wired into the "graph" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "graph" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

  • verbose name: Graph [Signature]
  • default value: (shape,dtype)
  • port type: Port
  • value type: object (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

  • verbose name: Set Breakpoint (Debug Only)
  • default value: False
  • port type: BoolPort
  • value type: bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

  • verbose name: Metadata
  • default value: {}
  • port type: DictPort
  • value type: dict (can be None)