rrule causes scalar indexing for `repeat`
まだ誰も着手していません。
評価
調査の方向性
CUDA.rand、repeat、Zygote.gradientを使ったJuliaの例を再現し、次にstack traceをZygoteのsrc/lib/array.jlと関連するChainRulesの挙動までたどります。GPU-arrayに対するこのrepeatケースで勾配パスがスカラーインデックスをトリガーしなくなり、その例を対象とする回帰テストが追加されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
julia> func(x) = sum(repeat(x, inner = (1, 3)))
func (generic function with 1 method)
julia> func(CUDA.rand(2,3))
7.5995846f0
julia> Zygote.gradient(func,CUDA.rand(2,3))
ERROR: Scalar indexing is disallowed.
Invocation of getindex resulted in scalar indexing of a GPU array.
This is typically caused by calling an iterating implementation of a method.
Such implementations *do not* execute on the GPU, but very slowly on the CPU,
and therefore are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] assertscalar(op::String)
@ GPUArraysCore C:\Users\Luffy\.julia\packages\GPUArraysCore\rSIl2\src\GPUArraysCore.jl:78
[3] getindex(::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, ::Int64, ::Int64)
@ GPUArrays C:\Users\Luffy\.julia\packages\GPUArrays\gok9K\src\host\indexing.jl:9
[4] getindex
@ C:\Users\Luffy\.julia\packages\GPUArrays\gok9K\src\host\indexing.jl:30 [inlined]
[5] iterate
@ .\iterators.jl:245 [inlined]
[6] (::Zygote.var"#519#525"{Tuple{Int64, Int64}, CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}})(Δ::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer})
@ Zygote C:\Users\Luffy\.julia\packages\Zygote\IoW2g\src\lib\array.jl:136
[7] #2693#back
@ C:\Users\Luffy\.julia\packages\ZygoteRules\AIbCs\src\adjoint.jl:73 [inlined]
[8] Pullback
@ .\REPL[15]:1 [inlined]
[9] (::Zygote.var"#60#61"{typeof(∂(func))})(Δ::Float32)
@ Zygote C:\Users\Luffy\.julia\packages\Zygote\IoW2g\src\compiler\interface.jl:41
[10] gradient(f::Function, args::CuArray{Float32, 2, CUDA.Mem.DeviceBuffer})
@ Zygote C:\Users\Luffy\.julia\packages\Zygote\IoW2g\src\compiler\interface.jl:76
[11] top-level scope
@ REPL[17]:1
[12] top-level scope
@ C:\Users\Luffy\.julia\packages\CUDA\tTK8Y\src\initialization.jl:52
- 主要言語
- Julia
- スター
- 475
- フォーク
- 98
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaDiff/ChainRules.jl のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JuliaDiff/ChainRules.jl#844 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
JuliaDiff/ChainRules.jl#818 ·
-
refactoring
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaDiff/ChainRules.jl#815 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
JuliaDiff/ChainRules.jl#810 ·
-
stack overflow issueオープン
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
JuliaDiff/ChainRules.jl#809 ·
JuliaDiff/ChainRules.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
oscar-system/GAP.jl#1455 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
JuliaAI/MLJTransforms.jl#85 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
SciML/OrdinaryDiffEq.jl#4875 ·
メンテナーはふだん 4 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
SciML/NonlinearSolve.jl#1372 ·
メンテナーはふだん 1 日以内に返信