gpt4 book ai didi

python - 使用 Python 层时,Caffe blob 中的 `num` 和 `count` 参数有什么区别?

转载 作者:行者123 更新时间:2023-12-02 09:19:44 25 4
gpt4 key购买 nike

Euclidean Loss Example对于 Caffe 中的 Python 层,可以使用 bottom[0].num 以及 bottom[0].count

看来两者的含义完全相同。

来自咖啡馆blob.hpp ,有同名的函数定义为:

inline int count() const { return count_; }

inline int num() const { return LegacyShape(0); }

似乎 count_ 跟踪 blob 中的元素数量,这似乎也是 num() 返回的值。

是这样的吗?我可以互换使用它们吗?

最佳答案

根据these Caffe docs , num 是“已弃用的旧版形状访问器 num:改用 shape(0)。”

另一方面,count是所有维度的乘积。

因此,num 为您提供了许多元素,每个元素可能有多个 channel 、高度和宽度。 count 是值的总数。仅当 shape 中的每个维度均为 1(shape(0) 除外)时,它们才应达成一致。

关于python - 使用 Python 层时,Caffe blob 中的 `num` 和 `count` 参数有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44442050/

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