pub struct ComputeFn { /* private fields */ }
Expand description
An instance of a compute function holding the implementation vtable and a set of registered compute kernels.
Implementations§
Source§impl ComputeFn
impl ComputeFn
Sourcepub fn new(id: ArcRef<str>, vtable: ArcRef<dyn ComputeFnVTable>) -> Self
pub fn new(id: ArcRef<str>, vtable: ArcRef<dyn ComputeFnVTable>) -> Self
Create a new compute function from the given ComputeFnVTable
.
Sourcepub fn register_kernel(&self, kernel: ArcRef<dyn Kernel>)
pub fn register_kernel(&self, kernel: ArcRef<dyn Kernel>)
Register a kernel for the compute function.
Sourcepub fn invoke(&self, args: &InvocationArgs<'_>) -> VortexResult<Output>
pub fn invoke(&self, args: &InvocationArgs<'_>) -> VortexResult<Output>
Invokes the compute function with the given arguments.
Sourcepub fn return_dtype(&self, args: &InvocationArgs<'_>) -> VortexResult<DType>
pub fn return_dtype(&self, args: &InvocationArgs<'_>) -> VortexResult<DType>
Compute the return type of the function given the input arguments.
Sourcepub fn return_len(&self, args: &InvocationArgs<'_>) -> VortexResult<usize>
pub fn return_len(&self, args: &InvocationArgs<'_>) -> VortexResult<usize>
Compute the return length of the function given the input arguments.
Sourcepub fn is_elementwise(&self) -> bool
pub fn is_elementwise(&self) -> bool
Returns whether the compute function is elementwise, i.e. the output is the same shape as
Auto Trait Implementations§
impl !Freeze for ComputeFn
impl !RefUnwindSafe for ComputeFn
impl Send for ComputeFn
impl Sync for ComputeFn
impl Unpin for ComputeFn
impl !UnwindSafe for ComputeFn
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
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