Struct rerun::components::TensorData
source · #[repr(transparent)]pub struct TensorData(pub TensorData);
Expand description
Component: An N-dimensional array of numbers.
The number of dimensions and their respective lengths is specified by the shape
field.
The dimensions are ordered from outermost to innermost. For example, in the common case of
a 2D RGB Image, the shape would be [height, width, channel]
.
These dimensions are combined with an index to look up values from the buffer
field,
which stores a contiguous array of typed values.
Tuple Fields§
§0: TensorData
Methods from Deref<Target = TensorData>§
sourcepub fn shape(&self) -> &[TensorDimension]
pub fn shape(&self) -> &[TensorDimension]
The shape of the tensor, including optional dimension names.
sourcepub fn shape_short(&self) -> &[TensorDimension]
pub fn shape_short(&self) -> &[TensorDimension]
Returns the shape of the tensor with all leading & trailing dimensions of size 1 ignored.
If all dimension sizes are one, this returns only the first dimension.
sourcepub fn num_dim(&self) -> usize
pub fn num_dim(&self) -> usize
The number of dimensions of the tensor.
An image tensor will usually have two (height, width) or three (height, width, channels) dimensions.
sourcepub fn is_vector(&self) -> bool
pub fn is_vector(&self) -> bool
Returns true if either all dimensions have size 1 or only a single dimension has a size larger than 1.
Empty tensors return false.
sourcepub fn get(&self, index: &[u64]) -> Option<TensorElement>
pub fn get(&self, index: &[u64]) -> Option<TensorElement>
Get the value of the element at the given index.
Return None
if out-of-bounds.
sourcepub fn dtype(&self) -> TensorDataType
pub fn dtype(&self) -> TensorDataType
The datatype of the tensor.
sourcepub fn size_in_bytes(&self) -> usize
pub fn size_in_bytes(&self) -> usize
The size of the tensor data, in bytes.
Trait Implementations§
source§impl Borrow<TensorData> for TensorData
impl Borrow<TensorData> for TensorData
source§fn borrow(&self) -> &TensorData
fn borrow(&self) -> &TensorData
source§impl Clone for TensorData
impl Clone for TensorData
source§fn clone(&self) -> TensorData
fn clone(&self) -> TensorData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TensorData
impl Debug for TensorData
source§impl Default for TensorData
impl Default for TensorData
source§fn default() -> TensorData
fn default() -> TensorData
source§impl Deref for TensorData
impl Deref for TensorData
§type Target = TensorData
type Target = TensorData
source§fn deref(&self) -> &TensorData
fn deref(&self) -> &TensorData
source§impl DerefMut for TensorData
impl DerefMut for TensorData
source§fn deref_mut(&mut self) -> &mut TensorData
fn deref_mut(&mut self) -> &mut TensorData
source§impl EntityDataUi for TensorData
impl EntityDataUi for TensorData
source§fn entity_data_ui(
&self,
ctx: &ViewerContext<'_>,
ui: &mut Ui,
ui_layout: UiLayout,
_entity_path: &EntityPath,
row_id: Option<RowId>,
_query: &LatestAtQuery,
_db: &EntityDb
)
fn entity_data_ui( &self, ctx: &ViewerContext<'_>, ui: &mut Ui, ui_layout: UiLayout, _entity_path: &EntityPath, row_id: Option<RowId>, _query: &LatestAtQuery, _db: &EntityDb )
source§impl<T> From<T> for TensorDatawhere
T: Into<TensorData>,
impl<T> From<T> for TensorDatawhere
T: Into<TensorData>,
source§fn from(v: T) -> TensorData
fn from(v: T) -> TensorData
source§impl Loggable for TensorData
impl Loggable for TensorData
type Name = ComponentName
source§fn name() -> <TensorData as Loggable>::Name
fn name() -> <TensorData as Loggable>::Name
rerun.datatypes.Vec2D
.source§fn arrow_datatype() -> DataType
fn arrow_datatype() -> DataType
arrow2::datatypes::DataType
, excluding datatype extensions.source§fn to_arrow_opt<'a>(
data: impl IntoIterator<Item = Option<impl Into<Cow<'a, TensorData>>>>
) -> Result<Box<dyn Array>, SerializationError>where
TensorData: Clone + 'a,
fn to_arrow_opt<'a>(
data: impl IntoIterator<Item = Option<impl Into<Cow<'a, TensorData>>>>
) -> Result<Box<dyn Array>, SerializationError>where
TensorData: Clone + 'a,
source§fn from_arrow_opt(
arrow_data: &(dyn Array + 'static)
) -> Result<Vec<Option<TensorData>>, DeserializationError>where
TensorData: Sized,
fn from_arrow_opt(
arrow_data: &(dyn Array + 'static)
) -> Result<Vec<Option<TensorData>>, DeserializationError>where
TensorData: Sized,
Loggable
s.source§fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> Result<Box<dyn Array>, SerializationError>where
Self: 'a,
fn to_arrow<'a>(
data: impl IntoIterator<Item = impl Into<Cow<'a, Self>>>
) -> Result<Box<dyn Array>, SerializationError>where
Self: 'a,
source§fn from_arrow(
data: &(dyn Array + 'static)
) -> Result<Vec<Self>, DeserializationError>
fn from_arrow( data: &(dyn Array + 'static) ) -> Result<Vec<Self>, DeserializationError>
Loggable
s.source§impl PartialEq for TensorData
impl PartialEq for TensorData
source§fn eq(&self, other: &TensorData) -> bool
fn eq(&self, other: &TensorData) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SizeBytes for TensorData
impl SizeBytes for TensorData
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl StructuralPartialEq for TensorData
Auto Trait Implementations§
impl Freeze for TensorData
impl RefUnwindSafe for TensorData
impl Send for TensorData
impl Sync for TensorData
impl Unpin for TensorData
impl UnwindSafe for TensorData
Blanket Implementations§
source§impl<C> AsComponents for Cwhere
C: Component,
impl<C> AsComponents for Cwhere
C: Component,
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatch
s. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
source§impl<C> ComponentBatch for Cwhere
C: Component,
impl<C> ComponentBatch for Cwhere
C: Component,
source§fn to_arrow_list_array(&self) -> Result<ListArray<i32>, SerializationError>
fn to_arrow_list_array(&self) -> Result<ListArray<i32>, SerializationError>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request