Trait ComputeFn

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

Source

fn id(&self) -> ArcRef<str>

The globally unique identifier for the compute function.

Source

fn as_any(&self) -> &dyn Any

Returns the function as the Any trait object.

Source

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.

Source

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.

Source

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.

Implementors§