Skip to main content

Float

Struct Float 

Source
pub struct Float;
Expand description

The three tensor kinds, used only as zero-sized compile-time markers on Tensor<D, K>. They never hold data; behaviour lives in the device ops traits.

Trait Implementations§

Source§

impl<D: Device> BytesDTypeKind<D> for Float

Source§

fn from_bytes_dispatch( bytes: &[u8], shape: &Shape, device: &D, dtype: FloatDType, ) -> Result<Self::Storage>

Source§

fn to_bytes_dispatch<'a>( storage: &'a Self::Storage, layout: &Layout, ) -> Result<Cow<'a, [u8]>>

Source§

impl<D: Device> ConstructDTypeKind<D> for Float

Source§

fn zeros_dispatch( shape: &Shape, device: &D, dtype: FloatDType, ) -> Result<Self::Storage>

Source§

fn ones_dispatch( shape: &Shape, device: &D, dtype: FloatDType, ) -> Result<Self::Storage>

Source§

fn full_dispatch( shape: &Shape, value: f64, device: &D, dtype: FloatDType, ) -> Result<Self::Storage>

Source§

impl<D: Device> DTypeKind<D> for Float

Source§

const KIND: KindTag = KindTag::Float

Runtime discriminant for this kind.
Source§

type Scalar = f64

Source§

type Storage = <D as Device>::FloatStorage

Source§

type Meta = FloatMeta<D>

Source§

type DType = FloatDType

Source§

impl<D: Device> IndexingDTypeKind<D> for Float

Source§

fn index_select_dispatch( x: &Self::Storage, x_l: &Layout, idx: &D::IntStorage, idx_l: &Layout, dim: usize, ) -> Result<(Self::Storage, Shape)>

Source§

fn gather_dispatch( x: &Self::Storage, x_l: &Layout, idx: &D::IntStorage, idx_l: &Layout, dim: usize, ) -> Result<(Self::Storage, Shape)>

Source§

fn index_add_dispatch( init: &Self::Storage, init_l: &Layout, idx: &D::IntStorage, idx_l: &Layout, src: &Self::Storage, src_l: &Layout, dim: usize, ) -> Result<Self::Storage>

Source§

fn scatter_add_dispatch( init: &Self::Storage, init_l: &Layout, idx: &D::IntStorage, idx_l: &Layout, src: &Self::Storage, src_l: &Layout, dim: usize, ) -> Result<Self::Storage>

Source§

impl<D: Device, T: FloatFrom> IntoTensor<D, Float> for T

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom> IntoTensor<D, Float> for &[T]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom> IntoTensor<D, Float> for Vec<T>

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom, const N: usize> IntoTensor<D, Float> for [T; N]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom, const N: usize> IntoTensor<D, Float> for &[T; N]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom, const R: usize, const C: usize> IntoTensor<D, Float> for &[[T; C]; R]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom, const D1: usize, const D2: usize, const D3: usize> IntoTensor<D, Float> for &[[[T; D3]; D2]; D1]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device, T: FloatFrom, const D1: usize, const D2: usize, const D3: usize, const D4: usize> IntoTensor<D, Float> for &[[[[T; D4]; D3]; D2]; D1]

Source§

fn shape(&self) -> Result<Shape>

Source§

fn into_storage(self, device: &D) -> Result<D::FloatStorage>

Source§

impl<D: Device> NumericDTypeKind<D> for Float

Source§

fn binary_dispatch( lhs: &Self::Storage, lhs_l: &Layout, rhs: &Self::Storage, rhs_l: &Layout, op: BinaryOp, ) -> Result<Self::Storage>

Source§

fn binary_inplace_dispatch( dst: &mut Self::Storage, dst_l: &Layout, src: &Self::Storage, src_l: &Layout, op: BinaryOp, ) -> Result<()>

Source§

fn binary_scalar_dispatch( lhs: &Self::Storage, lhs_l: &Layout, rhs: Self::Scalar, op: BinaryOp, ) -> Result<Self::Storage>

Source§

fn binary_scalar_inplace_dispatch( dst: &mut Self::Storage, dst_l: &Layout, rhs: Self::Scalar, op: BinaryOp, ) -> Result<()>

Source§

fn binary_scalar_lhs_dispatch( scalar: Self::Scalar, rhs: &Self::Storage, rhs_l: &Layout, op: BinaryOp, ) -> Result<Self::Storage>

Source§

fn cmp_dispatch( lhs: &Self::Storage, lhs_l: &Layout, rhs: &Self::Storage, rhs_l: &Layout, op: CmpOp, ) -> Result<D::BoolStorage>

Source§

fn cmp_scalar_dispatch( lhs: &Self::Storage, lhs_l: &Layout, rhs: Self::Scalar, op: CmpOp, ) -> Result<D::BoolStorage>

Source§

fn unary_dispatch( x: &Self::Storage, l: &Layout, op: UnaryOp<Self::Scalar>, ) -> Result<Self::Storage>

Source§

fn unary_inplace_dispatch( dst: &mut Self::Storage, dst_l: &Layout, op: UnaryOp<Self::Scalar>, ) -> Result<()>

Source§

impl<D: Device> ReduceDTypeKind<D> for Float

Source§

fn arg_reduce_dispatch( x: &Self::Storage, layout: &Layout, dim: usize, keepdim: bool, take_max: bool, ) -> Result<(D::IntStorage, Shape)>

Source§

fn reduce_dispatch( x: &Self::Storage, l: &Layout, dims: &[usize], keepdim: bool, op: ReduceOp, ) -> Result<(Self::Storage, Shape)>

Source§

impl<D: Device> ShapeDTypeKind<D> for Float

Source§

fn contiguous_dispatch(s: &Self::Storage, l: &Layout) -> Result<Self::Storage>

Source§

fn cat_dispatch( srcs: &[(&Self::Storage, &Layout)], dim: usize, ) -> Result<(Self::Storage, Shape)>

Source§

fn view_dispatch( src: &Self::Storage, src_l: &Layout, dst_l: &Layout, view: ViewOp, ) -> Result<Option<Self::Storage>>

Source§

impl Storage<Cpu, Float> for CpuFloatStorage

Source§

fn dtype(&self) -> FloatDType

Source§

fn device(&self) -> &Cpu

Source§

impl<D: Device> TensorMeta<D, Float> for FloatMeta<D>

Source§

fn on_binary( lhs: &Tensor<D, Float>, rhs: &Tensor<D, Float>, op: BinaryOp, ) -> Self

Source§

fn on_binary_scalar(lhs: &Tensor<D, Float>, rhs: f64, op: BinaryOp) -> Self

Source§

fn on_unary(t: &Tensor<D, Float>, op: UnaryOp<f64>) -> Self

Source§

fn on_float_unary(t: &Tensor<D, Float>, op: FloatUnaryOp) -> Self

Source§

fn on_reduce(t: &Tensor<D, Float>, dims: &[usize], op: ReduceOp) -> Self

Source§

fn on_matmul(lhs: &Tensor<D, Float>, rhs: &Tensor<D, Float>) -> Self

Source§

fn on_broadcast(t: &Tensor<D, Float>) -> Self

Source§

fn on_narrow(t: &Tensor<D, Float>, dim: usize, start: usize, len: usize) -> Self

Source§

fn on_slice( t: &Tensor<D, Float>, dim: usize, start: usize, end: usize, step: usize, ) -> Self

Source§

fn on_reshape(t: &Tensor<D, Float>) -> Self

Source§

fn on_transpose(t: &Tensor<D, Float>, dim1: usize, dim2: usize) -> Self

Source§

fn on_permute(t: &Tensor<D, Float>, dims: Vec<usize>) -> Self

Source§

fn on_cat<A: AsRef<Tensor<D, Float>>>(args: &[A], dim: usize) -> Self

Source§

fn on_copy(t: &Tensor<D, Float>) -> Self

Source§

fn on_cast(t: &Tensor<D, Float>) -> Self

Source§

fn on_index_select( t: &Tensor<D, Float>, idx: &Tensor<D, Int>, dim: usize, ) -> Self

Source§

fn on_gather(src: &Tensor<D, Float>, idx: &Tensor<D, Int>, dim: usize) -> Self

Source§

fn on_index_add( init: &Tensor<D, Float>, idx: &Tensor<D, Int>, src: &Tensor<D, Float>, dim: usize, ) -> Self

Source§

fn on_scatter_add( init: &Tensor<D, Float>, idx: &Tensor<D, Int>, src: &Tensor<D, Float>, dim: usize, ) -> Self

Source§

fn on_pick( mask: &Tensor<D, Bool>, tv: Option<&Tensor<D, Float>>, fv: Option<&Tensor<D, Float>>, ) -> Self

Source§

fn on_rms_norm( input: &Tensor<D, Float>, weight: &Tensor<D, Float>, eps: f64, ) -> Self

Source§

fn on_softmax(input: &Tensor<D, Float>, dim: usize) -> Self

Source§

impl<D: Device, D2: Device> TransferDTypeKind<D, D2> for Float

Source§

fn transfer(src: &Tensor<D, Float>, device: &D2) -> Result<Tensor<D2, Float>>

Auto Trait Implementations§

§

impl Freeze for Float

§

impl RefUnwindSafe for Float

§

impl Send for Float

§

impl Sync for Float

§

impl Unpin for Float

§

impl UnsafeUnpin for Float

§

impl UnwindSafe for Float

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V