首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >拉伸板caffe2找不到blob

拉伸板caffe2找不到blob
EN

Stack Overflow用户
提问于 2022-08-31 23:20:00
回答 1查看 30关注 0票数 1

我试着用以下几行用张板式编写器记录一些值。如果我将注释部分保留下来,那么代码就会运行良好。但是当我取消评论的时候,我会得到一个错误。如有任何建议,将不胜感激。

代码语言:javascript
复制
if (tb_writer != None):
        for key, value in qps.items():
            tb_writer.add_scalar("QPv2_" + mode + "_Threshold_" + str(key), value, global_step)
        # for annotation_idx in range(1, args.num_classes-1):
        #     annotation_class = annotation_classes[annotation_idx]
        #     for threshold_idx in range(len(annotation_thresholds)):
        #         threshold = annotation_thresholds[threshold_idx]
        #         tb_writer.add_scalar(annotation_class + "_Threshold_" + str(threshold) + "_Precision", str(precision[threshold_idx][annotation_idx].item()), global_step)
        #         tb_writer.add_scalar(annotation_class + "_Threshold_" + str(threshold) + "_Recall", str(recall[threshold_idx][annotation_idx].item()), global_step)
代码语言:javascript
复制
Traceback (most recent call last):
  File "train_transformer_v5.py", line 782, in <module>
    main()
  File "train_transformer_v5.py", line 763, in main
    global_step, tr_loss, metrics_result = trainer.train(args)
  File "train_transformer_v5.py", line 451, in train
    tb_writer=self.tb_writer, global_step=self.global_step)
  File "/home/xianx/model/metrics_v5.py", line 606, in eval_metrics
    tb_writer.add_scalar(annotation_class + "_Threshold_" + str(threshold) + "_Precision", str(precision[threshold_idx][annotation_idx].item()), global_step)
  File "/opt/conda/lib/python3.6/site-packages/torch/utils/tensorboard/writer.py", line 348, in add_scalar
    scalar_value = workspace.FetchBlob(scalar_value)
  File "/opt/conda/lib/python3.6/site-packages/caffe2/python/workspace.py", line 379, in FetchBlob
    result = C.fetch_blob(StringifyBlobName(name))
RuntimeError: [enforce fail at pybind_state.cc:221] ws->HasBlob(name). Can't find blob: 0.7158585786819458
EN

回答 1

Stack Overflow用户

发布于 2022-09-02 00:22:42

我的问题是,在将值转换为字符串时,我使用了.add_scalar(...)。移除这种转换解决了问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73562821

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档