Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ismutabletype on 1.7 #1023

Closed
marius311 opened this issue Jul 10, 2021 · 1 comment
Closed

Use ismutabletype on 1.7 #1023

marius311 opened this issue Jul 10, 2021 · 1 comment

Comments

@marius311
Copy link
Contributor

Due to JuliaLang/julia#39037, on 1.7 we have:

julia> foo(;kwargs...) = (;kwargs...,).x^2
foo (generic function with 1 method)

julia> gradient(x->foo(x=x), 1)
ERROR: type DataType has no field mutable
Stacktrace:
  [1] getproperty
    @ ./Base.jl:37 [inlined]
  [2] adjoint
    @ ~/.julia/packages/Zygote/i1R8y/src/lib/lib.jl:287 [inlined]
  [3] _pullback
    @ ~/.julia/packages/ZygoteRules/OjfTt/src/adjoint.jl:57 [inlined]
  [4] _pullback
    @ ./boot.jl:605 [inlined]
  [5] _pullback(ctx::Zygote.Context, f::Type{NamedTuple{(:x,), Tuple{Int64}}}, args::Tuple{Int64})
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface2.jl:0
  [6] _pullback
    @ ./boot.jl:601 [inlined]
  [7] _pullback(ctx::Zygote.Context, f::Type{NamedTuple{(:x,)}}, args::Tuple{Int64})
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface2.jl:0
  [8] _pullback
    @ ./REPL[12]:1 [inlined]
  [9] _pullback(ctx::Zygote.Context, f::var"#9#10", args::Int64)
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface2.jl:0
 [10] _pullback(f::Function, args::Int64)
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface.jl:34
 [11] pullback(f::Function, args::Int64)
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface.jl:40
 [12] gradient(f::Function, args::Int64)
    @ Zygote ~/.julia/packages/Zygote/i1R8y/src/compiler/interface.jl:58
 [13] top-level scope
    @ REPL[12]:1

I think the solution is just to replace instances of T.mutable in the code with a backwards compatible call to ismutabletype. I can hazard a PR unless someone suggests a better solution.

@marius311
Copy link
Contributor Author

marius311 commented Jul 11, 2021

Oops sorry I see its fixed on master 0.6.14 already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant