Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented magnitude #105

Merged
merged 3 commits into from
Sep 20, 2024
Merged

Conversation

RianGoossens
Copy link
Contributor

This is AFAIK the first time an implementation turns values of a vectorization factor X to an output of vectorization factor 1. This will be useful for many more functions like .mean(), so I first want to make this pull request before I start making a multitude of new functions.

The way I implemented it is through a new expand function called fixed_output_unary_expand with following signature:

pub fn fixed_output_unary_expand<F>(
    context: &mut CubeContext,
    input: ExpandElement,
    out_item: Item,
    func: F,
) -> ExpandElement

It works identical to unary_expand but it can take in a different output item, could be a different vectorization, could also be a different type, from the input. In principal this function is strictly more general than unary_expand, so perhaps unary_expand should just turn into this function. We can use the same concept to implement new binary functions like dot which also have a different vectorization factor for the output.

@RianGoossens RianGoossens marked this pull request as ready for review September 9, 2024 18:25
@nathanielsimard nathanielsimard merged commit f42bab4 into tracel-ai:main Sep 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants