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
还没有人认领这个 Issue。
评估
- 难度
- 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 会公开可训练变量,并为该行为添加或更新覆盖测试。
由索引模型根据 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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tensorflow/probability 的其他 Issue
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KL可能已有人在做 @Andreas-Hum 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
tensorflow/probability#2036 ·
-
难度 3/5 1-2 天 新手友好度 68/100
tensorflow/probability#2034 ·
-
难度 5/5 一周以上 新手友好度 35/100
tensorflow/probability#2021 ·
-
难度 4/5 3-5 天 新手友好度 30/100
tensorflow/probability#2015 ·
-
难度 3/5 1-2 天 新手友好度 48/100
tensorflow/probability#2013 ·
查看 tensorflow/probability 的全部 Issue
相似的 Issue
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex fails可能已有人在做 @vrjdev 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
DoubleML/doubleml-for-py#455 ·
维护者通常 1 天内回复
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)可能已有人在做 @lukepolson 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 79/100
PyTomography/PyTomography#435 ·
维护者通常 1 天内回复
-
beginner friendly
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 82/100
aws-samples/sample-per-model-bedrock#821 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
instadeepai/InstaNovo-FM#50 ·