MicrogradEx.Value.Node (MicrogradEx v0.1.0)

Copy Markdown View Source

The immutable record stored in a value's computation graph.

A MicrogradEx.Value is the small public handle that users pass around. The graph itself is a map of node id to this struct. Keeping nodes separate from values avoids recursive structs while still giving every output enough information to walk backward through the full expression that produced it.

Summary

Types

op()

@type op() :: :leaf | :+ | :- | :* | :neg | :relu | {:pow, number()}

t()

@type t() :: %MicrogradEx.Value.Node{
  data: float(),
  id: pos_integer(),
  label: String.t() | nil,
  op: op(),
  parents: [MicrogradEx.Value.Edge.t()]
}