Skip to content

ProjectTo{AbstractArray}(AbstractArray{NoTangent}) should be NoTangent #410

@oxinabox

Description

@oxinabox

Right now we have

julia> ProjectTo([1.0, 2.0])([NoTangent(), NoTangent()])
2-element Vector{NoTangent}:
 NoTangent()
 NoTangent()

I propose we want:

julia> ProjectTo([1.0, 2.0])([NoTangent(), NoTangent()])
NoTangent()

They are semantically the same: they are bot hrepresetnations of a nondifferentiable zero.
But NoTangent is nicer.
I think this would be helpful for several cases,
and I think it would be nicely symmetric with ProjectTo(Array{Bool})=ProjectTo{NoTangent}()

Cases it would help with is things like higher order function such as map and sum etc
I think often you can avoid it outright by not even computing the element for the function object, but sometimes it comes up for hte args.
E.g. map(getindex, xs, inds) it would still benefit since it would compress those inds

It came up in ChainRulesTestUtils

Metadata

Metadata

Assignees

No one assigned

    Labels

    ProjectTorelated to the projection functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions