|
pulsatrix 1.1.0
|
A set of points in R^dimension, built from activation batches. More...
#include <point_cloud.hpp>
Public Member Functions | |
| PointCloud (PointCloudOptions options={}) | |
| An empty cloud. | |
| void | add (const Tensor &batch) |
| Adds one batch. | |
| void | add (const ActivationSnapshot &snapshot, NodeId node) |
| Adds one forward pass's activations at a node. | |
| int64_t | size () const |
| The number of points. | |
| int64_t | dimension () const |
| Each point's number of coordinates; 0 until the first batch. | |
| int64_t | samples () const |
| The number of samples added, over every batch. | |
| const PointCloudOptions & | options () const |
| The settings it was built with. | |
| const std::vector< float > & | values () const |
| The points, row-major: size() rows of dimension() values. | |
| const std::vector< PointOrigin > & | origins () const |
| Where each point came from, in the same order as values(). | |
| Tensor | ToTensor (DeviceBackend *backend) const |
| The points as a (size(), dimension()) tensor. | |
A set of points in R^dimension, built from activation batches.
Add batches with add(); each is a tensor with the batch on its first axis. The first batch fixes the dimension, and every later one must give points of the same dimension. Batches may differ in their number of positions, so texts of different lengths can be added one by one.
Points are stored on the host as float32, as the activations were; ToTensor() places them on a backend for the distance computation.
|
explicit |
An empty cloud.
| std::invalid_argument | if options.pooling is out of range. |
| void pulsatrix::PointCloud::add | ( | const ActivationSnapshot & | snapshot, |
| NodeId | node | ||
| ) |
Adds one forward pass's activations at a node.
| node | One of snapshot.node_ids(). |
| std::invalid_argument | as add(const Tensor&) does. |
| void pulsatrix::PointCloud::add | ( | const Tensor & | batch | ) |
Adds one batch.
| batch | shape (batch, ...). For every pooling but Flatten it needs a feature axis: rank 2 or more, with options().feature_axis not the batch axis. A rank-2 tensor has one position per sample. |
| std::invalid_argument | if batch has rank below 2, an empty dimension, a NaN or infinity, a feature axis out of range or on the batch axis, or points of a different dimension from the batches before it. A batch that throws adds nothing. |
|
inline |
Each point's number of coordinates; 0 until the first batch.
|
inline |
The settings it was built with.
|
inline |
Where each point came from, in the same order as values().
|
inline |
The number of samples added, over every batch.
|
inline |
The number of points.
| Tensor pulsatrix::PointCloud::ToTensor | ( | DeviceBackend * | backend | ) | const |
The points as a (size(), dimension()) tensor.
| std::invalid_argument | if the cloud is empty. |
|
inline |
The points, row-major: size() rows of dimension() values.