Giter Site home page Giter Site logo

Comments (3)

MikeInnes avatar MikeInnes commented on May 28, 2024

This happens because the reduction code allocates scratch space which it assumes to have the same output type as the input. It also expects v0 to have the same type. There's no particular need for this, so if you can tweak those type hints it should all work.

(You could use Core.Inference.return_type to work out the return type)

from cuarrays.jl.

maleadt avatar maleadt commented on May 28, 2024

This also doesn't work on Array:

julia> a = randn(3, 3)
3×3 Array{Float64,2}:
  0.192888  -1.0884    -1.00464 
 -0.958028  -1.6191    -1.88764 
 -0.364282  -0.857092  -0.145727

julia> reduce((x0,x)->(x0[1]+x, x0[2]+abs(x)), (0.,0.), a)
ERROR: MethodError: no method matching reduce(::getfield(Main, Symbol("##3#4")), ::Tuple{Float64,Float64}, ::Array{Float64,2})

from cuarrays.jl.

MikeInnes avatar MikeInnes commented on May 28, 2024

Yeah, but that's a bug, JuliaLang/julia#31427; reduce just isn't written in a generic way when it clearly should support this case. The particular case above is also pretty easy to fix.

from cuarrays.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.