libtorch推理速度过慢

1 原因

torchscript runtime在第一阶段会进行优化

2 解决办法

#include <torch/csrc/jit/python/update_graph_executor_opt.h>

torch::jit::setGraphExecutorOptimize(false);

参考:https://discuss.pytorch.org/t/speed-of-custom-rnn-is-super-slow/63209

posted @ 2024-05-03 17:54  珠峰上吹泡泡  阅读(63)  评论(0编辑  收藏  举报