happens-to-be-zero zero for tangent space of primal
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- julia
調査の方向性
まず、リンクされている Zygote src/lib/array.jl の reduce と map 付近の行を読み、次に ChainRulesCore の rand_tangent と projection 機能を調べてください。この issue では、primitive 型と composite 型に対する値依存のゼロ接ベクトルを提案していますが、API と接ベクトル型の選択は未解決のままです。完了するには、これらのケースを対象とした合意済みの設計と実装が必要です。
索引モデルが issue の本文から書いたものです。
説明
Motivation
Somtimes it would be very convenient to have access to the element of the tangent space of a particular primal which happens to be zero for type-stability reasons. i.e. 0.0 and zeros(5, 4) rather than ZeroTangent.
The example I recently encountered where this would be helpful was reduce, specifically this line in Zygote's implementation of map. It's not possible to make this bit type-stable at the minute unless you know a priori whether or not the container you're mapping over is empty, so the pullback for map(function_with_fields, (5.0, 4.0)) infers, but the pullback map(function_with_fields, [5.0, 4.0]) does not. This is because the init kwarg is generally of a different type to the elements of Δf_and_args[1].
However, if we had access to a zero whose type doesn't change when we add cotangents to it, things ought to be type-stable.
Implementation
We know that the zero always exists, because the tangent space to a primal is a vector space, so there aren't any concerns regarding existence.
It's pretty clear what the right way to do this for composite types is via recursion (think rand_tangent, but zero rather than random), so we would just need to define it for primitives. It might get a little interesting here, because there are multiple possible tangent types for a Float64 primal (Float64, Float32, Float16, Int, etc) or a Vector primal (any AbstractVector of the same length with appropriate elements types), so possibly we would need additional information (such as the target tangent type) in order to do this.
Note that we do need to know the value of the primal for the same reasons that we need to have the primals hanging around in our projection functionality.
Anyway, I thought I'd bring this up because it's not something that we've thought much about before (ZeroTangent is often a really good option). It might be easier simply avoid situations like this most of the time (e.g. in the example I mentioned, using sized containers), but it's pretty annoying that the pullback for map isn't type-stable when mapping a closure over a Vector, because people to that a lot.
- 主要言語
- Julia
- スター
- 267
- フォーク
- 66
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaDiff/ChainRulesCore.jl のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
JuliaDiff/ChainRulesCore.jl#712 ·
メンテナーはふだん 1 日以内に返信
-
variable scope of `@thunk`対応中かも @chengchingwen が 620 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
JuliaDiff/ChainRulesCore.jl#684 ·
メンテナーはふだん 1 日以内に返信
-
good first issue Structural Tangent
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
JuliaDiff/ChainRulesCore.jl#669 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
JuliaDiff/ChainRulesCore.jl#668 · コメント 6 件 ·
メンテナーはふだん 1 日以内に返信
-
breaking
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
JuliaDiff/ChainRulesCore.jl#665 ·
メンテナーはふだん 1 日以内に返信
JuliaDiff/ChainRulesCore.jl の issue をすべて見る
似ている issue
-
release preparation spack
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
30-minutes algorithm any-language codewars dart easy elixir hackerrank hacktoberfest haskell help wanted interview-prep julia leetcode lua open-source r scala students zig
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Huerte/algo-solutions-python#163 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
QuantumSavory/QuantumClifford.jl#853 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
JuliaPackaging/Yggdrasil#15441 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
JuliaSmoothOptimizers/Penelopt.jl#260 ·
メンテナーはふだん 1 日以内に返信