如何在libtorch中从tensorRT fp16半类型指针创建张量?我正在研究一个检测模型。我把它的主干改成了tensorRT来做FP16推断,解码盒和nms等检测代码都是在libtorch和torchvisoin中完成的,那么如何从fp16半类型指针创建tensorRT张量呢?重要的代码是为了说明这个问题:
// tensorRT code to get half type outpus
half_float::half* outputs[18];
doInference(*engine, data, outputs, 1);
// to get the final outputs with libtorch
vector<torch::Tensor> output;
//???? how to feed the date in outpus to output????
// get the result with libtorch method detect_trt->forward
auto res = detect_trt->forward(output); 提前谢谢。
发布于 2020-04-27 17:38:33
我必须在TensorRT中做主干推理,但是post过程正在使用convenience.And的libtorch,现在我使用以下代码解决了这个问题:
out = torch::from_blob(outputs[i], {1, num, dim, dim}, torch::kFloat16).to(device_used);https://stackoverflow.com/questions/61400032
复制相似问题