9#include <unordered_map>
47 std::optional<std::string>
label;
62 std::unordered_map<NodeId, NodeMetadata> metadata)
63 : activations_(std::move(activations)), node_ids_(std::move(
node_ids)), metadata_(std::move(metadata)) {}
74 auto it = activations_.find(
id);
84 [[nodiscard]]
const std::vector<NodeId>&
node_ids()
const {
return node_ids_; }
91 auto it = metadata_.find(
id);
93 return it->second.op_type;
102 auto it = metadata_.find(
id);
104 return it->second.label;
108 std::unordered_map<NodeId, Tensor> activations_;
109 std::vector<NodeId> node_ids_;
110 std::unordered_map<NodeId, NodeMetadata> metadata_;
PULSATRIX_ASSERT – debug-only invariant check for programmer errors, distinct from throw (used for ca...
#define PULSATRIX_ASSERT(cond)
Aborts with a diagnostic message if cond is false. Debug-only – use for conditions that indicate a bu...
Definition assert.hpp:22
A copyable, self-contained record of every activation cached during one forward pass,...
Definition activation_snapshot.hpp:39
OpType op_type(NodeId id) const
The op-type tag captured at a node.
Definition activation_snapshot.hpp:90
ActivationSnapshot(std::unordered_map< NodeId, Tensor > activations, std::vector< NodeId > node_ids, std::unordered_map< NodeId, NodeMetadata > metadata)
Constructs a snapshot from already-captured data.
Definition activation_snapshot.hpp:61
const std::vector< NodeId > & node_ids() const
Every captured node id, in topological order as of capture time.
Definition activation_snapshot.hpp:84
const Tensor & activation(NodeId id) const
The activation value captured at a node.
Definition activation_snapshot.hpp:73
std::optional< std::string > label(NodeId id) const
The optional label captured at a node.
Definition activation_snapshot.hpp:101
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Definition acquisition_functions.hpp:16
size_t NodeId
Stable identifier for a Node within its owning ComputationGraph.
Definition node.hpp:18
OpType
The op-type tag a Node carries. Charter Part 2 §3: nodes are tagged by a small closed set of op types...
Definition op_type.hpp:19
Computation graph node – op type, shape, optional label, parent/child edges.
Closed set of operation categories every graph Node is tagged with.
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).