pulsatrix 1.1.0
Loading...
Searching...
No Matches
embedding_export.hpp
Go to the documentation of this file.
1
26#pragma once
27
28#include <cstdint>
29#include <string>
30#include <vector>
31
32#include "pulsatrix/tensor.hpp"
33
34namespace pulsatrix {
35
41[[nodiscard]] std::vector<uint8_t> SerializeNpy(const Tensor& x);
42
47void WriteNpy(const std::string& path, const Tensor& x);
48
59[[nodiscard]] Tensor ParseNpy(const std::vector<uint8_t>& bytes, DeviceBackend* backend);
60
65[[nodiscard]] Tensor ReadNpy(const std::string& path, DeviceBackend* backend);
66
74[[nodiscard]] std::string ProjectorVectorsTsv(const Tensor& x);
75
78 std::string name;
79 std::vector<std::string> values;
80};
81
92[[nodiscard]] std::string ProjectorMetadataTsv(const std::vector<MetadataColumn>& columns);
93
101void ExportEmbeddings(const std::string& directory, const Tensor& x, const std::vector<MetadataColumn>& columns = {});
102
103} // namespace pulsatrix
Vendor-agnostic compute/memory backend. CPUBackend, CUDABackend (Phase 1.5), and HIPBackend (Phase 1....
Definition device_backend.hpp:248
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Definition acquisition_functions.hpp:16
void WriteNpy(const std::string &path, const Tensor &x)
SerializeNpy() written to path.
void ExportEmbeddings(const std::string &directory, const Tensor &x, const std::vector< MetadataColumn > &columns={})
Writes x for UMAP and t-SNE tools into directory, which must exist: vectors.npy, vectors....
std::vector< uint8_t > SerializeNpy(const Tensor &x)
A tensor as a .npy file: format version 1.0, little-endian float32 (<f4), C order,...
std::string ProjectorMetadataTsv(const std::vector< MetadataColumn > &columns)
The Embedding Projector's metadata file: a line per point, a column per entry of columns,...
std::string ProjectorVectorsTsv(const Tensor &x)
The Embedding Projector's tensor file: a line per row of x, its values separated by tabs....
Tensor ParseNpy(const std::vector< uint8_t > &bytes, DeviceBackend *backend)
A .npy file as a float32 tensor on backend, with the file's shape.
Tensor ReadNpy(const std::string &path, DeviceBackend *backend)
ParseNpy() of the file at path.
One column of per-point metadata: a label, a class, a value as text.
Definition embedding_export.hpp:77
std::vector< std::string > values
Definition embedding_export.hpp:79
std::string name
Definition embedding_export.hpp:78
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).