113 [[nodiscard]] int64_t
size()
const {
return static_cast<int64_t
>(origins_.size()); }
116 [[nodiscard]] int64_t
dimension()
const {
return dimension_; }
119 [[nodiscard]] int64_t
samples()
const {
return samples_; }
125 [[nodiscard]]
const std::vector<float>&
values()
const {
return values_; }
128 [[nodiscard]]
const std::vector<PointOrigin>&
origins()
const {
return origins_; }
138 int64_t dimension_ = 0;
139 int64_t samples_ = 0;
140 std::vector<float> values_;
141 std::vector<PointOrigin> origins_;
Self-contained, enumerable copy of one forward pass's cached activations.
A copyable, self-contained record of every activation cached during one forward pass,...
Definition activation_snapshot.hpp:39
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:248
A set of points in R^dimension, built from activation batches.
Definition point_cloud.hpp:86
PointCloud(PointCloudOptions options={})
An empty cloud.
const std::vector< float > & values() const
The points, row-major: size() rows of dimension() values.
Definition point_cloud.hpp:125
const std::vector< PointOrigin > & origins() const
Where each point came from, in the same order as values().
Definition point_cloud.hpp:128
int64_t size() const
The number of points.
Definition point_cloud.hpp:113
int64_t samples() const
The number of samples added, over every batch.
Definition point_cloud.hpp:119
void add(const ActivationSnapshot &snapshot, NodeId node)
Adds one forward pass's activations at a node.
const PointCloudOptions & options() const
The settings it was built with.
Definition point_cloud.hpp:122
void add(const Tensor &batch)
Adds one batch.
Tensor ToTensor(DeviceBackend *backend) const
The points as a (size(), dimension()) tensor.
int64_t dimension() const
Each point's number of coordinates; 0 until the first batch.
Definition point_cloud.hpp:116
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
PointCloud MakePointCloud(const std::vector< ActivationSnapshot > &snapshots, NodeId node, PointCloudOptions options={})
A cloud from one node of several forward passes, such as one snapshot per batch.
PointPooling
How PointCloud turns one sample's activations into points.
Definition point_cloud.hpp:31
@ Mean
One point per sample: the mean over its positions.
@ Flatten
One point per sample: every dimension after the batch, flattened.
@ Max
One point per sample: the maximum over its positions, per feature.
@ PerPosition
One point per position (token, pixel): the feature axis is its coordinates.
@ Last
One point per sample: its last position, as a causal language model reads it.
Computation graph node – op type, shape, optional label, parent/child edges.
PointCloud's settings.
Definition point_cloud.hpp:45
int64_t feature_axis
The axis of an added tensor that holds the features, for every pooling but Flatten....
Definition point_cloud.hpp:54
PointPooling pooling
How each sample becomes points.
Definition point_cloud.hpp:47
Where one point of a PointCloud came from.
Definition point_cloud.hpp:58
int64_t sample
The sample: its index over every batch added, in the order they were added.
Definition point_cloud.hpp:60
int64_t position
The position within the sample (row-major over the position axes) for PerPosition and Last; -1 when t...
Definition point_cloud.hpp:63
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).