Open vinsis opened 2 years ago
The problematic step seems to be the conversion to Lab space:
julia> using Zygote, Colors
julia> gradient(x -> abs2(x.r), RGB(1, 0, 0)) # weird numbers are OK
((r = 0.996N0f8, g = nothing, b = nothing),)
julia> @less Colors._colordiff(RGB(1, 0, 0), RGB(0, 1, 0), Colors.DE_2000()) # converts
julia> gradient(x -> convert(Lab, x).l, RGB(1, 0, 0))
(nothing,)
I see. Did something change in Colors
or Zygote
? If this is expected behavior, I guess we should remove the example from the website.
Yes, I assume something changed. You can try different versions to bisect where & when, since I assume it worked when the docs were first written.
Link to tutorial: https://fluxml.ai/Zygote.jl/latest/
gradient(colordiff, RGB(1, 0, 0), RGB(0, 1, 0))
(nothing, nothing)
((r = 0.4590887719632896, g = -9.598786801605689, b = 14.181383399012862), (r = -1.7697549557037275, g = 28.88472330558805, b = -0.044793892637761346))
Julia version:
v1.7
Zygote version:v0.6.36