Trainable variables created by tfp.experimental.vi.util.build_trainable_linear_operator_block are lost after the resulting bijector is wrapped in a tfb.Chain

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python, tensorflow

調査の方向性

まず、TensorFlow 2.18.0 と TensorFlow Probability 0.25.0 を使って Python の例を再現し、build_trainable_linear_operator_block、ScaleMatvecLinearOperatorBlock、Chain に焦点を当てます。壊れている例と動作する例を比較し、その後、結果の Chain が trainable variables を公開することを確認して、その動作に対するカバレッジを追加または更新します。

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

説明

Creating a linear operator via the function tfp.experimental.vi.util.build_trainable_linear_operator_block and then plugging it into tfb.ScaleMatvecLinearOperatorBlock produces a bijector with trainable variables. If this bijector is then put inside a tfb.Chain(), trainable variables are no longer found by the reflection. The same is not true if the linear operator is created manually. My usage of tfp.experimental.vi.util.build_trainable_linear_operator_block is based on the tutorial Variational_Inference_and_Joint_Distributions

import tensorflow as tf
import tensorflow_probability as tfp
tfb = tfp.bijectors
print(tf.__version__)
# 2.18.0
print(tfp.__version__)
# 0.25.0


# Broken example (should print True)
operators = ((tf.linalg.LinearOperatorDiag,),)
block_tril_linop = tfp.experimental.vi.util.build_trainable_linear_operator_block(
    operators, (1,)
)
scale_bijector = tfb.ScaleMatvecLinearOperatorBlock(block_tril_linop)
assert len(scale_bijector.trainable_variables) > 0
c = tfb.Chain([scale_bijector])

print(len(c.trainable_variables) > 0)
# False



# Working example
LO = tf.linalg.LinearOperatorBlockDiag([tf.linalg.LinearOperatorDiag(tf.Variable([1.0]))])
scale_bijector = tfb.ScaleMatvecLinearOperatorBlock(LO)
assert len(scale_bijector.trainable_variables) > 0
c = tfb.Chain([scale_bijector])

print(len(c.trainable_variables) > 0)
# True
主要言語
Jupyter Notebook
スター
4.4k
フォーク
1.1k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

tensorflow/probability のほかの issue

tensorflow/probability の issue をすべて見る

似ている issue

Machine Learning の issue をもっと見る

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

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