在Tensorflow源代码中的Bool变量的初始化
Initialization of bool variables in tensorflow source code
在 tf.ConfigProto
configproto的tensorflow源代码中,布尔类型变量以一种奇怪的方式启动:
// If true, the allocator does not pre-allocate the entire specified
// GPU memory region, instead starting small and growing as needed.
bool allow_growth = 4;
bool force_gpu_compatible = 8;
bool use_rpc_for_inprocess_master = 1;
bool allow_soft_placement = 7;
...
为什么这些布尔不用true
和flase
或0
和1
启动?尽管值不是0在C 中被认为是true
,但这样做的含义是什么?4、8、7,似乎没有特定的规则可以使用哪个数字。
这些不是可变初始化。这些是消息中与这些字段关联的标签。有关更多信息,请查看此处。
相关文章:
- 是否可以初始化不可复制类型的成员变量(或基类)
- C++使用整数的压缩数组初始化对象
- C++初始化基类
- 多成员Constexpr结构初始化
- 复制列表初始化的隐式转换的等级是多少
- 内联映射初始化的动态atexit析构函数崩溃
- 如何在C++中初始化嵌套类中的2个memeber
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 没有用于初始化C++中的变量模板的匹配构造函数
- 在未初始化映射的情况下,将值插入到映射的映射中
- 如何在 C++11 中初始化 pair<vector<pair<bool,int>>,vector<pair<bool,int>>>
- 在Tensorflow源代码中的Bool变量的初始化
- 显式布尔操作员 - 无法返回,测试,初始化bool
- 使用类型"bool"类型的值初始化类型"int &"(非常量限定)的引用是否是一种黑客?
- 由 int 初始化的 can 向量<bool>
- c++ 11初始化列表中有多个bool的段错误
- 用于初始化 std::vector<std::function<bool(std::string)的初始值设定项列表> >在 g++ 4.9.0 中出错,但使用 Visual
- 带bool类型的字符串初始化
- 在返回语句中统一初始化,并显式将操作符转换为bool
- 错误:从类型为"std::vector:<bool>:reference {aka std::_Bit_reference}"的右值初始化类型为"bool&"的非常量引用无效