Skip to content

failure at handling globals on julia 1.12 #1591

@CarloLucibello

Description

@CarloLucibello

This test used to pass on julia < 1.12:

using Zygote, Test


julia> global_r = 1
1

julia> function pow_global(x, n)
           global global_r
           while n > 0
             global_r *= x
             n -= 1
           end
           return global_r
         end
pow_global (generic function with 1 method)

julia> @test gradient(pow_global, 2, 3) == (12, nothing)

Now the returned gradient is (nothing, nothing) instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions