pub trait ComputeFn {
// Required methods
fn id(&self) -> ArcRef<str>;
fn as_any(&self) -> &dyn Any;
fn invoke<'a>(&self, args: &'a InvocationArgs<'a>) -> VortexResult<Output>;
fn return_type<'a>(
&self,
args: &'a InvocationArgs<'a>,
) -> VortexResult<DType>;
fn is_elementwise(&self) -> bool;
}Required Methods§
Sourcefn invoke<'a>(&self, args: &'a InvocationArgs<'a>) -> VortexResult<Output>
fn invoke<'a>(&self, args: &'a InvocationArgs<'a>) -> VortexResult<Output>
Invokes the compute function entry-point with the given input arguments and options.
The entry-point logic can short-circuit compute using statistics, update result array statistics, search for relevant compute kernels, and canonicalize the inputs in order to successfully compute a result.
Sourcefn return_type<'a>(&self, args: &'a InvocationArgs<'a>) -> VortexResult<DType>
fn return_type<'a>(&self, args: &'a InvocationArgs<'a>) -> VortexResult<DType>
Computes the return type of the function given the input arguments.
All kernel implementations will be validated to return the DType as computed here.
Sourcefn is_elementwise(&self) -> bool
fn is_elementwise(&self) -> bool
Returns whether the function operates elementwise, i.e. the output is the same shape as the input and no information is shared between elements.
Examples include add, subtract, and, cast, fill_null etc.
Examples that are not elementwise include sum, count, min, fill_forward etc.