PixelCNN example from the documentation does not work
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- jupyter-notebook, python, tensorflow
调研方向
从 TensorFlow Probability API 文档 URL 中的 PixelCNN 示例开始,并使用 TensorFlow 2.19 在 Google Colab 中复现该示例。检查 dist.log_prob(image_input) 处的失败,并追踪报告的 KerasTensor 异常。完成的标准是文档中的示例能够成功运行且不出现此异常。
由索引模型根据 Issue 内容生成。
描述
How to repro?
TF version: 2.19.0
- Take an example from https://www.tensorflow.org/probability/api_docs/python/tfp/distributions/PixelCNN#examples
- Create Google Colab
- Past the example into the Google Colab
- Run it
The following exception occurs:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[/tmp/ipython-input-624558695.py](https://localhost:8080/#) in <cell line: 0>()
33
34 # Define the log likelihood for the loss fn
---> 35 log_prob = dist.log_prob(image_input)
36
37 # Define the model
6 frames
<decorator-gen-128> in shape_v2(input, out_type, name)
[/usr/local/lib/python3.12/dist-packages/keras/src/backend/common/keras_tensor.py](https://localhost:8080/#) in __tf_tensor__(self, dtype, name)
154
155 def __tf_tensor__(self, dtype=None, name=None):
--> 156 raise ValueError(
157 "A KerasTensor cannot be used as input to a TensorFlow function. "
158 "A KerasTensor is a symbolic placeholder for a shape and dtype, "
ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces `keras.layers` and `keras.ops`). You are likely doing something like:
```
x = Input(...)
...
tf_fn(x) # Invalid.
```
What you should do instead is wrap `tf_fn` in a layer:
```
class MyLayer(Layer):
def call(self, x):
return tf_fn(x)
x = MyLayer()(x)
```
- 主要语言
- 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 ·
-
难度 4/5 3-5 天 新手友好度 35/100
tensorflow/probability#2012 · 1 条评论 ·
查看 tensorflow/probability 的全部 Issue
相似的 Issue
-
area/access-management Frontend onboarding candidate :handshake:
难度 2/5 1-3 小时 新手友好度 65/100
Altinn/altinn-auth#4941 ·
维护者通常 1 天内回复
-
hermes-queue
难度 1/5 1 小时以内 新手友好度 91/100
chrisalunlloyd2-sudo/mindpalace#373 ·
维护者通常 1 天内回复
-
documentation
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
ACK_WAITING HELP_WANTED UPDATE_CS
难度 2/5 1-3 小时 新手友好度 83/100
OWASP/CheatSheetSeries#2935 ·
维护者通常 1 天内回复
-
type:docs
难度 2/5 1-3 小时 新手友好度 82/100
jejjohnson/xtremax#123 ·