python - TensorFlow op 属性的默认值可以是 NaN 还是 Inf?
问题描述
我的情况是向TensorFlow ImageSummary Opvmin
添加和vmax
属性。这是我用于此操作注册的代码:
REGISTER_OP("ImageSummary")
.Input("tag: string")
.Input("tensor: T")
.Output("summary: string")
.Attr("vmin: float = NaN")
.Attr("vmax: float = NaN")
.Attr("clip: bool = false")
.Attr("max_images: int >= 1 = 3")
.Attr("T: {uint8, float, half, float64} = DT_FLOAT")
.Attr(
"bad_color: tensor = { dtype: DT_UINT8 "
"tensor_shape: { dim { size: 4 } } "
"int_val: 255 int_val: 0 int_val: 0 int_val: 255 }")
.SetShapeFn(shape_inference::ScalarShape);
虽然这适用于C++ 测试代码,但在构建整个项目时出现了一些错误:
bazel-out/darwin-opt/genfiles/tensorflow/cc/ops/logging_ops.h:237:19: error: cannot initialize a member subobject of type 'float' with an lvalue of type 'float (const char *)'
float vmin_ = nanf;
^~~~
bazel-out/darwin-opt/genfiles/tensorflow/cc/ops/logging_ops.h:238:19: error: cannot initialize a member subobject of type 'float' with an lvalue of type 'float (const char *)'
float vmax_ = nanf;
我认为它应该是float vmin = nanf("")
并且float vmax = nanf("")
在logging_ops.h
. 这是 TensorFlow 编译器中的问题吗?或者我可能对设置默认值的语法有一些误解?
对我的案子有什么建议吗?
解决方案
推荐阅读
- vue.js - Easeljs:“createjs.Ticker.paused = true”不起作用
- iccube - 服务器端PDF导出功能
- java - 如何在 Java 中向 Octoprint 发送 POST 请求?
- solr - 按 document.contentType 搜索
- amp-html - 您可以在非 amp 页面上使用 AMP 标签吗?
- go - Go 中的切片如何不被取消引用?
- html - HTML标签的Python网页抓取
- java - String.equals() 方法在 Windows 中不匹配
- windows - Windows 上用于 youtube-dl 的批处理文件不起作用
- cassandra-2.0 - 无法使用 cassandra 驱动程序在 Cassandra 中存储 base64 图像数据