Struct rerun::components::TensorData
#[repr(transparent)]pub struct TensorData(pub TensorData);
Expand description
Component: A multi-dimensional Tensor
with optionally named arguments.
Tuple Fields§
§0: TensorData
Methods from Deref<Target = TensorData>§
pub fn shape(&self) -> &[TensorDimension]
pub fn shape_short(&self) -> &[TensorDimension]
pub fn shape_short(&self) -> &[TensorDimension]
Returns the shape of the tensor with all trailing dimensions of size 1 ignored.
If all dimension sizes are one, this returns only the first dimension.
pub fn num_dim(&self) -> usize
pub fn image_height_width_channels(&self) -> Option<[u64; 3]>
pub fn image_height_width_channels(&self) -> Option<[u64; 3]>
If the tensor can be interpreted as an image, return the height, width, and channels/depth of it.
pub fn is_shaped_like_an_image(&self) -> bool
pub fn is_shaped_like_an_image(&self) -> bool
Returns true if the tensor can be interpreted as an image.
pub 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.
pub fn get_with_image_coords(
&self,
x: u64,
y: u64,
channel: u64
) -> Option<TensorElement>
pub fn get_with_image_coords( &self, x: u64, y: u64, channel: u64 ) -> Option<TensorElement>
Query with x, y, channel indices.
Allows to query values for any image like tensor even if it has more or less dimensions than 3.
(useful for sampling e.g. N x M x C x 1
tensor which is a valid image)
pub fn get(&self, index: &[u64]) -> Option<TensorElement>
pub fn get_nv12_pixel(&self, x: u64, y: u64) -> Option<[TensorElement; 3]>
pub fn get_nv12_pixel(&self, x: u64, y: u64) -> Option<[TensorElement; 3]>
Returns decoded RGB8 value at the given image coordinates if this tensor is a valid NV12 image.
pub fn dtype(&self) -> TensorDataType
pub fn size_in_bytes(&self) -> usize
pub fn could_be_dynamic_image(&self) -> bool
pub fn could_be_dynamic_image(&self) -> bool
Predicts if Self::to_dynamic_image
is likely to succeed, without doing anything expensive
pub fn to_dynamic_image(&self) -> Result<DynamicImage, TensorImageSaveError>
pub fn to_dynamic_image(&self) -> Result<DynamicImage, TensorImageSaveError>
Try to convert an image-like tensor into an image::DynamicImage
.
Trait Implementations§
§impl Borrow<TensorData> for TensorData
impl Borrow<TensorData> for TensorData
§fn borrow(&self) -> &TensorData
fn borrow(&self) -> &TensorData
§impl Clone for TensorData
impl Clone for TensorData
§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 more§impl Debug for TensorData
impl Debug for TensorData
§impl Deref for TensorData
impl Deref for TensorData
§type Target = TensorData
type Target = TensorData
§fn deref(&self) -> &TensorData
fn deref(&self) -> &TensorData
§impl EntityDataUi for TensorData
impl EntityDataUi for TensorData
§fn entity_data_ui(
&self,
ctx: &mut ViewerContext<'_>,
ui: &mut Ui,
verbosity: UiVerbosity,
entity_path: &EntityPath,
query: &LatestAtQuery
)
fn entity_data_ui( &self, ctx: &mut ViewerContext<'_>, ui: &mut Ui, verbosity: UiVerbosity, entity_path: &EntityPath, query: &LatestAtQuery )
§impl<T> From<T> for TensorDatawhere
T: Into<TensorData>,
impl<T> From<T> for TensorDatawhere T: Into<TensorData>,
§fn from(v: T) -> TensorData
fn from(v: T) -> TensorData
§impl Loggable for TensorData
impl Loggable for TensorData
type Name = ComponentName
§fn name() -> <TensorData as Loggable>::Name
fn name() -> <TensorData as Loggable>::Name
rerun.datatypes.Vec2D
.§fn arrow_datatype() -> DataType
fn arrow_datatype() -> DataType
arrow2::datatypes::DataType
, excluding datatype extensions.§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,
Loggable
, serializes them into an Arrow array.
The Arrow array’s datatype will match Loggable::arrow_field
. Read more§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,
§fn extended_arrow_datatype() -> DataType
fn extended_arrow_datatype() -> DataType
arrow2::datatypes::DataType
, including datatype extensions. Read more§fn arrow_field() -> Field
fn arrow_field() -> Field
arrow2::datatypes::Field
, including datatype extensions. Read more§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,
Loggable
, serializes
them into an Arrow array.
The Arrow array’s datatype will match Loggable::arrow_field
. Read more§fn from_arrow(
data: &(dyn Array + 'static)
) -> Result<Vec<Self>, DeserializationError>
fn from_arrow( data: &(dyn Array + 'static) ) -> Result<Vec<Self>, DeserializationError>
§impl PartialEq for TensorData
impl PartialEq for TensorData
§fn eq(&self, other: &TensorData) -> bool
fn eq(&self, other: &TensorData) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for TensorData
Auto Trait Implementations§
impl RefUnwindSafe for TensorData
impl Send for TensorData
impl Sync for TensorData
impl Unpin for TensorData
impl UnwindSafe for TensorData
Blanket Implementations§
source§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>
§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>
§impl<L> LoggableBatch for Lwhere
L: Clone + Loggable,
impl<L> LoggableBatch for Lwhere L: Clone + Loggable,
type Name = <L as Loggable>::Name
§fn name(&self) -> <L as LoggableBatch>::Name
fn name(&self) -> <L as LoggableBatch>::Name
rerun.datatypes.Vec2D
.§fn num_instances(&self) -> usize
fn num_instances(&self) -> usize
§fn arrow_field(&self) -> Field
fn arrow_field(&self) -> Field
arrow2::datatypes::Field
, including datatype extensions.