[−][src]Struct tract_nnef::prelude::Tensor
Tensor is a concrete tensor in tract.
Implementations
impl Tensor
[src]
pub unsafe fn uninitialized<T>(shape: &[usize]) -> Result<Tensor, TractError> where
T: Datum,
[src]
T: Datum,
Create an uninitialized tensor (dt as type paramater).
pub unsafe fn uninitialized_dt(
dt: DatumType,
shape: &[usize]
) -> Result<Tensor, TractError>
[src]
dt: DatumType,
shape: &[usize]
) -> Result<Tensor, TractError>
Create an uninitialized tensor (dt as regular parameter).
pub unsafe fn uninitialized_aligned<T>(
shape: &[usize],
alignment: usize
) -> Result<Tensor, TractError> where
T: Datum,
[src]
shape: &[usize],
alignment: usize
) -> Result<Tensor, TractError> where
T: Datum,
Create an uninitialized tensor with a given alignment (in bytes).
pub unsafe fn uninitialized_aligned_dt(
dt: DatumType,
shape: &[usize],
alignment: usize
) -> Result<Tensor, TractError>
[src]
dt: DatumType,
shape: &[usize],
alignment: usize
) -> Result<Tensor, TractError>
Create an uninitialized tensor with a given alignment (in bytes).
pub fn stack_tensors(
axis: usize,
tensors: &[impl Borrow<Tensor>]
) -> Result<Tensor, TractError>
[src]
axis: usize,
tensors: &[impl Borrow<Tensor>]
) -> Result<Tensor, TractError>
pub fn zero<T>(shape: &[usize]) -> Result<Tensor, TractError> where
T: Datum + Zero,
[src]
T: Datum + Zero,
pub fn zero_dt(dt: DatumType, shape: &[usize]) -> Result<Tensor, TractError>
[src]
pub unsafe fn from_raw<T>(
shape: &[usize],
content: &[u8]
) -> Result<Tensor, TractError> where
T: Datum,
[src]
shape: &[usize],
content: &[u8]
) -> Result<Tensor, TractError> where
T: Datum,
Create an tensor from raw data.
It copies the data, aligning it to the size of T.
pub unsafe fn from_raw_dt(
dt: DatumType,
shape: &[usize],
content: &[u8]
) -> Result<Tensor, TractError>
[src]
dt: DatumType,
shape: &[usize],
content: &[u8]
) -> Result<Tensor, TractError>
pub fn rank(&self) -> usize
[src]
Get the number of dimensions (or axes) of the tensor.
pub fn shape(&self) -> &[usize]ⓘ
[src]
Get the shape of the tensor.
pub fn len(&self) -> usize
[src]
Get the number of valeus in the tensor.
pub unsafe fn set_shape_unchecked(&mut self, shape: &[usize])
[src]
Force the tensor shape, no consistency check.
pub fn set_shape(&mut self, shape: &[usize]) -> Result<(), TractError>
[src]
Force the tensor shape.
pub fn permute_axes(self, axes: &[usize]) -> Result<Tensor, TractError>
[src]
pub fn into_shape(self, shape: &[usize]) -> Result<Tensor, TractError>
[src]
Reshape the tensor to shape
.
pub fn insert_axis(&mut self, axis: usize) -> Result<(), TractError>
[src]
pub fn remove_axis(&mut self, axis: usize) -> Result<(), TractError>
[src]
pub fn broadcast_into_rank(self, rank: usize) -> Result<Tensor, TractError>
[src]
pub fn broadcast_to_rank(&mut self, rank: usize) -> Result<(), TractError>
[src]
pub fn datum_type(&self) -> DatumType
[src]
Get the datum type of the tensor.
pub unsafe fn set_datum_type(&mut self, dt: DatumType)
[src]
Set the datum type of the tensor.
pub fn dump(&self, force_full: bool) -> Result<String, TractError>
[src]
Dump the tensor in a human readable form.
force_full
will force the tensor to be dump in full even if it is big.
pub fn close_enough(
&self,
other: &Tensor,
approx: bool
) -> Result<(), TractError>
[src]
&self,
other: &Tensor,
approx: bool
) -> Result<(), TractError>
Compare two tensors, allowing for rounding errors.
pub fn into_array<D>(
self
) -> Result<ArrayBase<OwnedRepr<D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
[src]
self
) -> Result<ArrayBase<OwnedRepr<D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
Transform the tensor into a ndarray::Array
.
pub unsafe fn into_array_unchecked<D>(
self
) -> ArrayBase<OwnedRepr<D>, Dim<IxDynImpl>> where
D: Datum,
[src]
self
) -> ArrayBase<OwnedRepr<D>, Dim<IxDynImpl>> where
D: Datum,
Transform the tensor into a ndarray::Array
.
pub fn to_array_view<D>(
&'a self
) -> Result<ArrayBase<ViewRepr<&'a D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
[src]
&'a self
) -> Result<ArrayBase<ViewRepr<&'a D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
Transform the data as a ndarray::Array
.
pub fn to_array_view_mut<D>(
&'a mut self
) -> Result<ArrayBase<ViewRepr<&'a mut D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
[src]
&'a mut self
) -> Result<ArrayBase<ViewRepr<&'a mut D>, Dim<IxDynImpl>>, TractError> where
D: Datum,
Transform the data as a mutable ndarray::Array
.
pub unsafe fn to_array_view_unchecked<D>(
&'a self
) -> ArrayBase<ViewRepr<&'a D>, Dim<IxDynImpl>> where
D: Datum,
[src]
&'a self
) -> ArrayBase<ViewRepr<&'a D>, Dim<IxDynImpl>> where
D: Datum,
Transform the data as a ndarray::Array
.
pub unsafe fn to_array_view_mut_unchecked<D>(
&'a mut self
) -> ArrayBase<ViewRepr<&'a mut D>, Dim<IxDynImpl>> where
D: Datum,
[src]
&'a mut self
) -> ArrayBase<ViewRepr<&'a mut D>, Dim<IxDynImpl>> where
D: Datum,
Transform the data as a mutable ndarray::Array
.
pub fn as_ptr<D>(&self) -> Result<*const D, TractError> where
D: Datum,
[src]
D: Datum,
Access the data as a pointer.
pub unsafe fn as_ptr_unchecked<D>(&self) -> *const D where
D: Datum,
[src]
D: Datum,
Access the data as a pointer.
pub unsafe fn as_ptr_mut_unchecked<D>(&mut self) -> *mut D where
D: Datum,
[src]
D: Datum,
Access the data as a pointer.
pub fn as_ptr_mut<D>(&mut self) -> Result<*mut D, TractError> where
D: Datum,
[src]
D: Datum,
Access the data as a mutable pointer.
pub fn as_slice<D>(&self) -> Result<&[D], TractError> where
D: Datum,
[src]
D: Datum,
Access the data as a slice.
pub fn as_slice_mut<D>(&mut self) -> Result<&mut [D], TractError> where
D: Datum,
[src]
D: Datum,
Access the data as a mutable slice.
pub unsafe fn as_slice_unchecked<D>(&self) -> &[D]ⓘ where
D: Datum,
[src]
D: Datum,
Access the data as a slice.
pub unsafe fn as_slice_mut_unchecked<D>(&mut self) -> &mut [D]ⓘ where
D: Datum,
[src]
D: Datum,
Access the data as a mutable slice.
pub fn to_scalar<D>(&'a self) -> Result<&'a D, TractError> where
D: Datum,
[src]
D: Datum,
Access the data as a scalar.
pub unsafe fn to_scalar_unchecked<D>(&'a self) -> &'a DⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
where
D: Datum,
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
D: Datum,
Access the data as a scalar.
pub unsafe fn as_bytes(&self) -> &[u8]ⓘ
[src]
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8]ⓘ
[src]
pub fn is_uniform(&self) -> Result<bool, TractError>
[src]
pub fn cast_to<D>(&self) -> Result<Cow<'_, Tensor>, TractError> where
D: Datum,
[src]
D: Datum,
Optionnaly convert data to a tensor for a new DatumType.
pub fn cast_to_dt(&self, dt: DatumType) -> Result<Cow<'_, Tensor>, TractError>
[src]
Optionnaly convert data to a tensor for a new DatumType.
pub fn cast_to_scalar<D>(&self) -> Result<D, TractError> where
D: Datum + Copy,
[src]
D: Datum + Copy,
Access the data as a scalar, after a cast.
pub fn deep_clone(&self) -> Tensor
[src]
pub fn slice(
&self,
axis: usize,
start: usize,
end: usize
) -> Result<Tensor, TractError>
[src]
&self,
axis: usize,
start: usize,
end: usize
) -> Result<Tensor, TractError>
Trait Implementations
impl Clone for Tensor
[src]
impl Debug for Tensor
[src]
impl Default for Tensor
[src]
impl Drop for Tensor
[src]
impl<'t> From<&'t Tensor> for TypedFact
[src]
impl<D, T> From<ArrayBase<OwnedRepr<T>, D>> for Tensor where
D: Dimension,
T: Datum,
[src]
D: Dimension,
T: Datum,
impl From<Blob> for Tensor
[src]
impl From<String> for Tensor
[src]
impl From<TDim> for Tensor
[src]
impl From<Tensor> for TypedFact
[src]
impl From<bool> for Tensor
[src]
impl From<f16> for Tensor
[src]
impl From<f32> for Tensor
[src]
impl From<f64> for Tensor
[src]
impl From<i16> for Tensor
[src]
impl From<i32> for Tensor
[src]
impl From<i64> for Tensor
[src]
impl From<i8> for Tensor
[src]
impl From<u16> for Tensor
[src]
impl From<u32> for Tensor
[src]
impl From<u64> for Tensor
[src]
impl From<u8> for Tensor
[src]
impl Hash for Tensor
[src]
fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl IntoArcTensor for Tensor
[src]
fn into_arc_tensor(self) -> Arc<Tensor>
[src]
impl PartialEq<Tensor> for Tensor
[src]
impl Send for Tensor
[src]
impl Sync for Tensor
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>ⓘNotable traits for Box<W>
impl<W> Write for Box<W> where
W: Write + ?Sized, impl<R> Read for Box<R> where
R: Read + ?Sized, impl<F> Future for Box<F> where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<I> Iterator for Box<I> where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
Notable traits for Box<W>
impl<W> Write for Box<W> where
W: Write + ?Sized, impl<R> Read for Box<R> where
R: Read + ?Sized, impl<F> Future for Box<F> where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;impl<I> Iterator for Box<I> where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,