Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::datatypes::TensorBuffer Struct Reference

Datatype: The underlying storage for a Tensor. More...

#include <rerun/datatypes/tensor_buffer.hpp>

Public Member Functions

 TensorBuffer (const TensorBuffer &other)
 Copy constructor.
 
TensorBufferoperator= (const TensorBuffer &other) noexcept
 
 TensorBuffer (TensorBuffer &&other) noexcept
 
TensorBufferoperator= (TensorBuffer &&other) noexcept
 
 TensorBuffer (Collection< uint8_t > u8)
 Construct a TensorBuffer from a Collection<uint8_t>.
 
 TensorBuffer (Collection< uint16_t > u16)
 Construct a TensorBuffer from a Collection<uint16_t>.
 
 TensorBuffer (Collection< uint32_t > u32)
 Construct a TensorBuffer from a Collection<uint32_t>.
 
 TensorBuffer (Collection< uint64_t > u64)
 Construct a TensorBuffer from a Collection<uint64_t>.
 
 TensorBuffer (Collection< int8_t > i8)
 Construct a TensorBuffer from a Collection<int8_t>.
 
 TensorBuffer (Collection< int16_t > i16)
 Construct a TensorBuffer from a Collection<int16_t>.
 
 TensorBuffer (Collection< int32_t > i32)
 Construct a TensorBuffer from a Collection<int32_t>.
 
 TensorBuffer (Collection< int64_t > i64)
 Construct a TensorBuffer from a Collection<int64_t>.
 
 TensorBuffer (Collection< rerun::half > f16)
 Construct a TensorBuffer from a Collection<half>.
 
 TensorBuffer (Collection< float > f32)
 Construct a TensorBuffer from a Collection<float>.
 
 TensorBuffer (Collection< double > f64)
 Construct a TensorBuffer from a Collection<double>.
 
template<typename TContainer , typename value_type = traits::value_type_of_t<TContainer>>
 TensorBuffer (TContainer &&container)
 Construct a TensorBuffer from any container type that has a value_type member and for which a rerun::ContainerAdapter exists.
 
size_t num_elems () const
 Number of elements in the buffer.
 
void swap (TensorBuffer &other) noexcept
 
const rerun::Collection< uint8_t > * get_u8 () const
 Return a pointer to u8 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint16_t > * get_u16 () const
 Return a pointer to u16 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint32_t > * get_u32 () const
 Return a pointer to u32 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint64_t > * get_u64 () const
 Return a pointer to u64 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< int8_t > * get_i8 () const
 Return a pointer to i8 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< int16_t > * get_i16 () const
 Return a pointer to i16 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< int32_t > * get_i32 () const
 Return a pointer to i32 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< int64_t > * get_i64 () const
 Return a pointer to i64 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< rerun::half > * get_f16 () const
 Return a pointer to f16 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< float > * get_f32 () const
 Return a pointer to f32 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< double > * get_f64 () const
 Return a pointer to f64 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint8_t > * get_jpeg () const
 Return a pointer to jpeg if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint8_t > * get_nv12 () const
 Return a pointer to nv12 if the union is in that state, otherwise nullptr.
 
const rerun::Collection< uint8_t > * get_yuy2 () const
 Return a pointer to yuy2 if the union is in that state, otherwise nullptr.
 

Static Public Member Functions

static TensorBuffer u8 (rerun::Collection< uint8_t > u8)
 8bit unsigned integer.
 
static TensorBuffer u16 (rerun::Collection< uint16_t > u16)
 16bit unsigned integer.
 
static TensorBuffer u32 (rerun::Collection< uint32_t > u32)
 32bit unsigned integer.
 
static TensorBuffer u64 (rerun::Collection< uint64_t > u64)
 64bit unsigned integer.
 
static TensorBuffer i8 (rerun::Collection< int8_t > i8)
 8bit signed integer.
 
static TensorBuffer i16 (rerun::Collection< int16_t > i16)
 16bit signed integer.
 
static TensorBuffer i32 (rerun::Collection< int32_t > i32)
 32bit signed integer.
 
static TensorBuffer i64 (rerun::Collection< int64_t > i64)
 64bit signed integer.
 
static TensorBuffer f16 (rerun::Collection< rerun::half > f16)
 16bit IEEE-754 floating point, also known as half.
 
static TensorBuffer f32 (rerun::Collection< float > f32)
 32bit IEEE-754 floating point, also known as float or single.
 
static TensorBuffer f64 (rerun::Collection< double > f64)
 64bit IEEE-754 floating point, also known as double.
 
static TensorBuffer jpeg (rerun::Collection< uint8_t > jpeg)
 Raw bytes of a JPEG file.
 
static TensorBuffer nv12 (rerun::Collection< uint8_t > nv12)
 NV12 is a YUV 4:2:0 chroma downsamples format with 8 bits per channel.
 
static TensorBuffer yuy2 (rerun::Collection< uint8_t > yuy2)
 YUY2, also known as YUYV is a YUV 4:2:2 chroma downsampled format with 8 bits per channel.
 

Detailed Description

Datatype: The underlying storage for a Tensor.

Tensor elements are stored in a contiguous buffer of a single type.

Constructor & Destructor Documentation

◆ TensorBuffer()

template<typename TContainer , typename value_type = traits::value_type_of_t<TContainer>>
rerun::datatypes::TensorBuffer::TensorBuffer ( TContainer &&  container)
inline

Construct a TensorBuffer from any container type that has a value_type member and for which a rerun::ContainerAdapter exists.

This constructor assumes the type of tensor buffer you want to use is defined by TContainer::value_type and then forwards the argument as-is to the appropriate rerun::Container constructor.

See also
rerun::ContainerAdapter, rerun::Container

Member Function Documentation

◆ num_elems()

size_t rerun::datatypes::TensorBuffer::num_elems ( ) const

Number of elements in the buffer.

You may NOT call this for JPEG buffers.

◆ nv12()

static TensorBuffer rerun::datatypes::TensorBuffer::nv12 ( rerun::Collection< uint8_t >  nv12)
inlinestatic

NV12 is a YUV 4:2:0 chroma downsamples format with 8 bits per channel.

First comes entire image in Y, followed by interleaved lines ordered as U0, V0, U1, V1, etc.

◆ yuy2()

static TensorBuffer rerun::datatypes::TensorBuffer::yuy2 ( rerun::Collection< uint8_t >  yuy2)
inlinestatic

YUY2, also known as YUYV is a YUV 4:2:2 chroma downsampled format with 8 bits per channel.

The order of the channels is Y0, U0, Y1, V0.


The documentation for this struct was generated from the following file: