Need a way to pass trainable Variables to Optimizer
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 928
- フォーク
- 227
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
In woking with Model training, an issue on Optimizer has shown its head.
Currently, when calling minimize(loss) on the Optimizer instance, the Optimizer code walks the entire Graph and pulls out all the defined Variables in the graph. The idea is when you call minimize(loss), the Optimizer builds gradients based on all the variables. However, when working with Model, this "all variables approach" breaks down, because some variables are not referenced in the loss operand execution path. This produces the following error:
org.tensorflow.exceptions.TFInvalidArgumentException: Cannot compute the partial derivative for node 'model/mse_total' as it's unreachable from the output node(s).
This specific error is because the MSE metric's internal variables are not within the loss execution path. This pattern of "non-trainable variables (weights)" is in most Metric classes, and in the Model itself, so it is wide spread. What we need is a way to distinguish between trainable and non-trainable variables. Trainable variables would then be used to calculate the gradient values in the Optimizer.
In Python tensorflow, the Keras Layers track the trainable variables as an attribute list, the Model then passes the collected lists to the Optimizer's minimize method.
There are a couple of options here:
- Mimic TF Keras, and have each
Layeridentify its trainable variables, Then, pass the trainable variables as aList<Variable<?> listusing a call like,Optimizer.minimize(loss, trainableVariables), then have theOptimizerminimizeroutine calladdGradientswith this variable list, rather than walk the whole Graph, to compute the gradients. - Within
Optimzier.minimize(loss), walk thelossoperand execution path to locate any variables contributing to the loss calculation, then pass these toaddGradients. A solution based on this option may be facilitated using #232, "Add graph walking functions to Graph and GraphOperation".
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Start with Optimizer.minimize(loss), its addGradients path, and the Graph/GraphOperation graph-walking work in #232. Compare the two proposed approaches and inspect how Model and Metric variables are represented. Done means a decided API or graph traversal that excludes non-trainable variables and avoids the reported unreachable-node error.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java, tensorflow
- 領域
- backend-api-design, machine-learning
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100