Skip to content

Do we want to support generators? (comprehensions, sum, etc.) #22

@dlfivefifty

Description

@dlfivefifty

Is it possible to auto-diff the following:

julia> function mynorm(x)
       sqrt(sum(x^2 for x in x))
       end
mynorm (generic function with 1 method)

julia> mynorm([1,2,3])
3.7416573867739413

Or more generally, differentiate code with comprehensions ([x^2 for x in x]), minimum, etc.

This is hard since Generator uses anonymous functions.

map and broadcast also have this issue when passed an anonymous function. It's possible there's a work around by making a type BroadcastedDualVector that turns all the relevant function calls into broadcasted versions.

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