69 [[nodiscard]] std::optional<TensorAccess>
view()
const {
return m_data.access(); }
77 [[nodiscard]] std::optional<TensorAccess> view(
const Region& region)
const;
80 [[nodiscard]] std::vector<DataDimension> get_dimensions()
const override;
83 [[nodiscard]] uint64_t get_total_elements()
const override;
86 [[nodiscard]]
MemoryLayout get_memory_layout()
const override;
92 [[nodiscard]] uint64_t get_frame_size()
const override;
95 [[nodiscard]] uint64_t get_num_frames()
const override;
101 [[nodiscard]] std::vector<TensorData> get_region_data(
const Region& region)
const override;
108 [[nodiscard]] std::vector<TensorData> get_region_group_data(
const RegionGroup& group)
const override;
118 [[nodiscard]] std::vector<TensorData> get_segments_data(
const std::vector<RegionSegment>& segments)
const override;
126 void set_region_data(
const Region& region,
const std::vector<TensorData>& data)
override;
144 [[nodiscard]]
bool is_region_loaded(
const Region& region)
const override;
156 [[nodiscard]] uint64_t coordinates_to_linear_index(
const std::vector<uint64_t>& coordinates)
const override;
162 [[nodiscard]] std::vector<uint64_t> linear_index_to_coordinates(uint64_t linear_index)
const override;
165 void clear()
override;
168 [[nodiscard]]
const void* get_raw_data()
const override;
Typed key for an arbitrary attribute stored in a Facets bag.
Abstract interface for N-dimensional data containers.
void set_structure(ContainerDataStructure structure) override
Replace structure metadata.
const ContainerDataStructure & get_structure() const override
Structure metadata.
ContainerDataStructure & get_structure() override
Mutable structure metadata.
void set_memory_layout(MemoryLayout) override
The layout is described by the tensor's strides and is not changed here.
std::unordered_map< std::string, RegionGroup > m_region_groups
void unload_region(const Region &) override
The tensor stays resident until clear() is called.
std::unordered_map< std::string, RegionGroup > get_all_region_groups() const override
Copy all named region groups.
uint64_t get_total_elements() const override
Number of elements in the tensor.
ContainerDataStructure m_structure
TensorContainer(TensorData data)
Take ownership of a tensor.
TensorInsertion insert() noexcept
Create an insertion adapter for the tensor.
std::optional< TensorAccess > view() const
Borrow the whole tensor.
~TensorContainer() override
void load_region(const Region &) override
The tensor is resident.
bool has_data() const override
Whether the tensor contains any elements.
const TensorData & get_data() const noexcept
Borrow the tensor.
Owning host tensor: a TensorSpec and the bytes it describes.
Mutable adapter for writing into a TensorData.
const Facet< TensorData > & tensor_cache()
Key for a cached TensorData held by a RegionSegment.
void remove_region_group(std::unordered_map< std::string, RegionGroup > &groups, const std::string &name)
Remove a RegionGroup by name from a group map.
std::optional< RegionGroup > get_region_group(const std::unordered_map< std::string, RegionGroup > &groups, const std::string &name)
Get a RegionGroup by name from a group map.
@ TENSOR_ND
N-dimensional tensor.
MemoryLayout
Memory layout for multi-dimensional data.
@ INTERLEAVED
Single DataVariant with interleaved data (LRLRLR for stereo).
void add_region_group(std::unordered_map< std::string, RegionGroup > &groups, const RegionGroup &group)
Add a RegionGroup to a group map.
Container structure for consistent dimension ordering.
Organizes related signal regions into a categorized collection.
Represents a point or span in N-dimensional space.
Complete description of a tensor: type, shape, layout, meaning.