Skip to content

reduce with function #38

@AntonOresten

Description

@AntonOresten

There should be an easier way to do the equivalent of mean(abs2, x, dims=1) with the Einops syntax. Currently, one might have to do:

reduce((x; dims) -> mean(abs2, x; dims), x, (:a, ..) --> (..))

I'd consider moving the both the function used to reduce, and the function applied to each term, to the back of the reduce function like so:

reduce(x, (:a, ..) --> (..), mean, abs2)

Ignoring e.g. abs2, this is also closer to the Python syntax:

reduce(x, 'a ... -> ...', 'mean')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions