Skip to content

Constructor for collect(iterable layers) #36

@darsnack

Description

@darsnack

I came across this use case when working on FluxPrune.jl. If I have an array of functions that operate on layers, then I can do map((f, m) -> f(m), fs, model) when model is iterable like Chain or Parallel. But this returns a vector of layers instead of the type of model. For Chain, I can just pass the output of map back into the constructor, but this isn't the case for Parallel.

Of course, I can special case fs::AbstractVector and model::Chain in my case, but it would be nice to have a more generic way to do this. Basically something like re from Functors.jl but for the output of iterate(model).

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