gpt4 book ai didi

c++ - tensorflow源码中bool变量的初始化

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:08:16 26 4
gpt4 key购买 nike

tf.ConfigProto 的 tensorflow 源代码中 configproto , bool 类型变量以一种奇怪的方式初始化:

// 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;
...

为什么不使用 trueflase 或仅使用 01 初始化这些 bool 值?虽然非0的值在c++中被认为是true,但这样做有什么意义呢? 4、8、7,似乎没有特定的规则来使用哪个数字。

最佳答案

那些不是变量初始化。这些是与消息中的那些字段关联的标签。更多信息,look here .

关于c++ - tensorflow源码中bool变量的初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46188162/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com