Giter Club home page Giter Club logo

Comments (6)

Jutho avatar Jutho commented on September 28, 2024

Simply from looking at the stack trace (I have not tested it myself), it seems as if the pullback function of tensortrace! gets a Tuple{Float64} as adjoint input ΔC, instead of an Array{Float64,0}. This is strange, as the pullback rule of tensorscalar does transform a scalar back into a Array{Float64,0} value. Is Zygote trying to be smart here, by replacing this zero-dimensional array with a Tuple in between these two steps? Or is it somehow simply sidestepping the pullback rule of tensorscalar?

from tensoroperations.jl.

pbrehmer avatar pbrehmer commented on September 28, 2024

I just quickly checked: The pullback rule of tensorscalar is being called and it does indeed output an Array{Float64,0}. Then ΔC somehow gets converted to a Tuple{Float64} in tensortrace!. Is this perhaps also related to the @thunk and unthunk of ChainRulesCore?

What's also weird is that pC is just an empty tuple ((), ()) such that numind(pC) in tensortrace! errors as well, when I force ΔC to be of the correct type. So I don't quite understand what is happening under the hood of Zygote here.

from tensoroperations.jl.

Jutho avatar Jutho commented on September 28, 2024

So apparently it's not Zygote's fault, but ours.

julia> scale(fill(0.5), 0.3)
(0.15,)

scale is the culprit here that changes the Array{Float64,0} into a Tuple{Float64}. Will investigate further, this should very clearly not happen!

Addendum:
The reason seems to be with broadcasting; broadcasting is used to implement scale(::AbstractArray, ::Number), but it treats zero-dimensional arrays specially and does not preserve them.

from tensoroperations.jl.

Jutho avatar Jutho commented on September 28, 2024

Ok, so this fixes it on my side: Jutho/VectorInterface.jl@d4d1129

As soon as the tests turn green, I will tag a new release.

from tensoroperations.jl.

pbrehmer avatar pbrehmer commented on September 28, 2024

Great, thanks for the fast fix!

from tensoroperations.jl.

lkdvos avatar lkdvos commented on September 28, 2024

Fixed and tagged in v4.1

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