Struct math::tensor::ephemeral_view::EphemeralView
source · pub struct EphemeralView<'a, Dtype> {
pub shape: TensorShape,
pub data: &'a TensorStorage<Dtype>,
}
Expand description
A View of the Underlying Referenced Data as a Particular Shape
The underlying data
has to outlive the EphemeralView
itself.
Examples
use math::tensor::{
ephemeral_view::ToEphemeralView, tensor_shape::HasTensorShape,
tensor_storage::IntoTensorStorage,
};
let storage = vec![1, 2, 3, 4].into_tensor_storage();
let view = storage.as_shape(vec![4, 1]);
assert_eq!(view.shape().dims(), vec![4, 1]);
Fields§
§shape: TensorShape
§data: &'a TensorStorage<Dtype>
Implementations§
source§impl<'a, Dtype> EphemeralView<'a, Dtype>
impl<'a, Dtype> EphemeralView<'a, Dtype>
pub fn new<S: Into<TensorShape>>( data: &'a TensorStorage<Dtype>, shape: S ) -> EphemeralView<'a, Dtype>
Trait Implementations§
source§impl<'a, Dtype: 'a> BorrowTensor<'a, Dtype> for EphemeralView<'_, Dtype>
impl<'a, Dtype: 'a> BorrowTensor<'a, Dtype> for EphemeralView<'_, Dtype>
type Output = EphemeralView<'a, Dtype>
fn create_borrowed_tensor( shape: TensorShape, data_ref: &'a TensorStorage<Dtype> ) -> Self::Output
source§impl<'a, Dtype: Clone> Clone for EphemeralView<'a, Dtype>
impl<'a, Dtype: Clone> Clone for EphemeralView<'a, Dtype>
source§fn clone(&self) -> EphemeralView<'a, Dtype>
fn clone(&self) -> EphemeralView<'a, Dtype>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a, Dtype: Debug> Debug for EphemeralView<'a, Dtype>
impl<'a, Dtype: Debug> Debug for EphemeralView<'a, Dtype>
source§impl<'a, Dtype> From<&'a Matrix<Dtype>> for EphemeralView<'a, Dtype>
impl<'a, Dtype> From<&'a Matrix<Dtype>> for EphemeralView<'a, Dtype>
source§impl<Dtype> HasTensorData<Dtype> for EphemeralView<'_, Dtype>
impl<Dtype> HasTensorData<Dtype> for EphemeralView<'_, Dtype>
fn data(&self) -> &TensorStorage<Dtype>
source§impl<Dtype> HasTensorShape for EphemeralView<'_, Dtype>
impl<Dtype> HasTensorShape for EphemeralView<'_, Dtype>
fn shape(&self) -> &TensorShape
source§impl<'a, Dtype: PartialEq> PartialEq for EphemeralView<'a, Dtype>
impl<'a, Dtype: PartialEq> PartialEq for EphemeralView<'a, Dtype>
source§fn eq(&self, other: &EphemeralView<'a, Dtype>) -> bool
fn eq(&self, other: &EphemeralView<'a, Dtype>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a, Dtype> ToIterator<'a, TensorIter<'a, Dtype>, Dtype> for EphemeralView<'a, Dtype>where
Dtype: Copy,
impl<'a, Dtype> ToIterator<'a, TensorIter<'a, Dtype>, Dtype> for EphemeralView<'a, Dtype>where
Dtype: Copy,
fn to_iter(&'a self) -> TensorIter<'a, Dtype> ⓘ
impl<'a, Dtype: Eq> Eq for EphemeralView<'a, Dtype>
impl<'a, Dtype> StructuralEq for EphemeralView<'a, Dtype>
impl<'a, Dtype> StructuralPartialEq for EphemeralView<'a, Dtype>
Auto Trait Implementations§
impl<'a, Dtype> RefUnwindSafe for EphemeralView<'a, Dtype>where
Dtype: RefUnwindSafe,
impl<'a, Dtype> Send for EphemeralView<'a, Dtype>where
Dtype: Sync,
impl<'a, Dtype> Sync for EphemeralView<'a, Dtype>where
Dtype: Sync,
impl<'a, Dtype> Unpin for EphemeralView<'a, Dtype>
impl<'a, Dtype> UnwindSafe for EphemeralView<'a, Dtype>where
Dtype: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more