sophgo / sophon-stream

Other
76 stars 13 forks source link

多线程使用模型预测时为什么可以不用加锁? #48

Closed BaofengZan closed 2 months ago

BaofengZan commented 2 months ago

https://github.com/sophgo/sophon-stream/blob/12342bdc464b5aa0143f2ffcc127a5b6c83657b9/element/algorithm/yolov8/src/yolov8.cc#L246

你好,我看源码中 yolov8 element中只有一个context,如果这个element的ThreadNum大于1,这里使用模型预测时为什么可以不用加锁?

Yi-sir commented 2 months ago

输入输出tensor都不是成员变量,没必要加锁

BaofengZan commented 2 months ago

o,感谢。我明白了 !