AllentDan / LibtorchTutorials

This is a code repository for pytorch c++ (or libtorch) tutorial.
Apache License 2.0
742 stars 122 forks source link

传递Torch::Device 类型参数报错 #10

Closed JohnHerry closed 1 year ago

JohnHerry commented 2 years ago

你好, 请教一下,Torch::Device对象可以作为函数形参吗? 我们封装模型推理器时,怎么让调用者可以动态指定计算设备?

AllentDan commented 2 years ago

@JohnHerry 可以作为对象传参啊,不行字符串都行,自己写好映射函数