pub struct InputScalar { /* private fields */ }Expand description
A way to define an input scalar without a generic attached to it.
It uses comptime enum with zero-cost runtime abstraction for kernel generation.
Implementations§
Source§impl InputScalar
impl InputScalar
Sourcepub fn new<E: ToPrimitive>(val: E, dtype: impl Into<StorageType>) -> Self
pub fn new<E: ToPrimitive>(val: E, dtype: impl Into<StorageType>) -> Self
Creates an InputScalar from the given element and dtype.
§Panics
If the given numeric element can’t be transformed into the passed ElemType.
Source§impl InputScalar
impl InputScalar
Sourcepub fn get<C: Scalar>(&self) -> C
pub fn get<C: Scalar>(&self) -> C
Reads the scalar with the given element type.
Performs casting if necessary.
Sourcepub fn __expand_get<C: Scalar>(
scope: &Scope,
this: &<Self as CubeType>::ExpandType,
) -> <C as CubeType>::ExpandType
pub fn __expand_get<C: Scalar>( scope: &Scope, this: &<Self as CubeType>::ExpandType, ) -> <C as CubeType>::ExpandType
Reads the scalar with the given element type.
Performs casting if necessary.
Trait Implementations§
Source§impl Clone for InputScalar
impl Clone for InputScalar
Source§fn clone(&self) -> InputScalar
fn clone(&self) -> InputScalar
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for InputScalar
Source§impl CubeType for InputScalar
impl CubeType for InputScalar
Source§impl Debug for InputScalar
impl Debug for InputScalar
Source§impl LaunchArg for InputScalar
impl LaunchArg for InputScalar
Source§type RuntimeArg<R: Runtime> = InputScalar
type RuntimeArg<R: Runtime> = InputScalar
The runtime argument for the kernel.
Source§type CompilationArg = InputScalarCompilationArg
type CompilationArg = InputScalarCompilationArg
Compilation argument.
fn register<R: Runtime>( arg: Self::RuntimeArg<R>, launcher: &mut KernelLauncher<R>, ) -> Self::CompilationArg
Source§fn expand(
arg: &Self::CompilationArg,
builder: &mut KernelBuilder,
) -> <Self as CubeType>::ExpandType
fn expand( arg: &Self::CompilationArg, builder: &mut KernelBuilder, ) -> <Self as CubeType>::ExpandType
Register a variable during compilation that fill the
KernelBuilder.Auto Trait Implementations§
impl Freeze for InputScalar
impl RefUnwindSafe for InputScalar
impl Send for InputScalar
impl Sync for InputScalar
impl Unpin for InputScalar
impl UnsafeUnpin for InputScalar
impl UnwindSafe for InputScalar
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneExpand for Twhere
T: Clone,
impl<T> CloneExpand for Twhere
T: Clone,
fn __expand_clone_method(&self, _: &Scope) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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