Consider handling rrules for kwargs differently?

オープン
#384 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
julia

調査の方向性

まず、f(args...; kwargs...) の形の呼び出しの lowering を追跡し、issue で説明されている既存の Core.kwfunc rrule 定義と比較します。通常の rrule 定義と frule 定義がどのように表現されているかを確認し、そのうえで、どの API の動作または lowering 規則を変更すべきかを判断します。この issue では、確定した実装も完了テストも定義されていません。

索引モデルが issue の本文から書いたものです。

説明

The lowering for a call like:

f(args...; kwargs...)

is

Core.kwfunc(f)(kwargs, args...)

By the usual rules of rrule invocation, the rrule for this call is:

rrule(Core.kwfunc(f), kwargs, args...)

However, this misses the rrules we define here, which instead expect:

Core.kwfunc(rrule)(kwargs, f, args...)

This is not forces every AD system to have special case rules for detecting kwcalls of this sort, which is non-trivial.
An alternative would be to make the rrule(Core.kwfunc(f), kwargs, args...) call primitive, though of course that would require changing the user-facing way to write rrules. This could then be fixed with a macro, but of course ChainRules currently does not use a macro for regular rrule/frule definitions... Neither alternative is particularly pleasant, but I figured I'd open this for discussion.

主要言語
Julia
スター
267
フォーク
66
平均マージ
1日 1時間
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaDiff/ChainRulesCore.jl のほかの issue

JuliaDiff/ChainRulesCore.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。