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
torchscript runtime在第一阶段会进行优化
#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