Giter Site home page Giter Site logo

Comments (2)

mcabbott avatar mcabbott commented on July 17, 2024

I wonder if making ProjectTo look inside containers was a mistake. Maybe it should be content to deal with the outer array here, and assume that whatever rule made the inner arrays knew what it was doing (or called ProjectTo itself)?

That said I don't quite see where this instability is from, why doesn't map infer if the elements infer?

julia> @code_warntype map(ProjectTo, x)
MethodInstance for map(::Type{ProjectTo}, ::Vector{Vector{Float64}})
  from map(f, A::AbstractArray) in Base at abstractarray.jl:2933
Arguments
  #self#::Core.Const(map)
  f::Type{ProjectTo}
  A::Vector{Vector{Float64}}
Body::Union{Vector{ProjectTo{AbstractArray, NamedTuple{(:element, :axes), Tuple{ProjectTo{Float64, NamedTuple{(), Tuple{}}}, Tuple{Base.OneTo{Int64}}}}}}, Vector{Any}}
...

julia> @code_warntype ProjectTo(x[1])
MethodInstance for ProjectTo(::Vector{Float64})
  from ProjectTo(x::AbstractArray{T}) where T<:Number in ChainRulesCore at /Users/me/.julia/packages/ChainRulesCore/ctmSK/src/projection.jl:200
Static Parameters
  T = Float64
Arguments
  #self#::Type{ProjectTo}
  x::Vector{Float64}
Body::ProjectTo{AbstractArray, NamedTuple{(:element, :axes), Tuple{ProjectTo{Float64, NamedTuple{(), Tuple{}}}, Tuple{Base.OneTo{Int64}}}}}

from chainrulescore.jl.

willtebbutt avatar willtebbutt commented on July 17, 2024

That said I don't quite see where this instability is from, why doesn't map infer if the elements infer?

I was wondering that. Usually map infers things nicely 🤷

from chainrulescore.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.