Any idea on why it doesn’t work with CUDA
julia> using Flux, LinearAlgebra
julia> x = randn(10, 10);
julia> xgpu = gpu(x);
julia> gradient(x -> sum(svd(x).S), xgpu)
ERROR: MethodError: no method matching svd_rev(::CUDA.CUSOLVER.CuSVD{Float32,Float32,CUDA.CuArray{Float32,2}}, ::ChainRulesCore.Zero, ::CUDA.CuArray{Float32,1}, ::ChainRulesCore.Zero)
Closest candidates are:
svd_rev(::SVD, ::Any, ::Any, ::Any) at /home/arl/.julia/packages/ChainRules/fxzix/src/rulesets/LinearAlgebra/factorization.jl:235
but is completely fine with CPU?
julia> gradient(x -> sum(svd(x).S), x)
([0.22422035794513845 -0.22840843902956595 … -0.11853353221499852 -0.2644796980043797; 0.3925933912813142 -0.17862913793640262 … -0.07040796485757393 -0.2394096734163877; … ; 0.1322218981131396 0.04551545691787621 … 0.046312344885702884 0.27236765206728764; -0.014331187321234687 -0.08331098168443869 … 0.28966886173762263 -0.2966424859947306],)
Julia and package versions:
julia> versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-1630 v3 @ 3.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, haswell)
(jl_zGZp9B) pkg> st
Status `/tmp/jl_zGZp9B/Project.toml`
[587475ba] Flux v0.11.6