vscode中解决Module 'torch' has no 'randn' member

1、打开vscode设置

2、在设置的搜索窗口搜索:python.linting.pylintPath

3、更新Pylint Path路径,然后ctrl+s 完成

4、如何找到pylint-2.4.2的路径?

可以下载个everything,然后直接在搜索框里面搜索。(这个软件搜索速度很快)

/home/chenjiayi/code/params-tuning/deploy/inference.cpp: In function ‘void optimize_input(at::Tensor, at::Tensor, at::Tensor, std::string, at::Tensor, float)’: /home/chenjiayi/code/params-tuning/deploy/inference.cpp:22:17: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 22 | return -1; | ^ /home/chenjiayi/code/params-tuning/deploy/inference.cpp:39:15: error: ‘class torch::optim::SGD’ has no member named ‘backwards’ 39 | optimizer.backwards(); | ^~~~~~~~~ /home/chenjiayi/code/params-tuning/deploy/inference.cpp:50:22: error: return-statement with a value, in function returning ‘void’ [-fpermissive] 50 | return dx.detach(); | ^ /home/chenjiayi/code/params-tuning/deploy/inference.cpp: In function ‘int main()’: /home/chenjiayi/code/params-tuning/deploy/inference.cpp:59:9: error: expected ‘,’ or ‘;’ before ‘torch’ 59 | torch::Tensor x_mean = torch::tensor({21.947811126708984, 14326.2626953125, 16.138383865356445, 0.39696937799453735, 0.7555552124977112}); | ^~~~~ /home/chenjiayi/code/params-tuning/deploy/inference.cpp:59:145: error: expected primary-expression before ‘)’ token 59 | torch::Tensor x_mean = torch::tensor({21.947811126708984, 14326.2626953125, 16.138383865356445, 0.39696937799453735, 0.7555552124977112}); | ^ /home/chenjiayi/code/params-tuning/deploy/inference.cpp:64:74: error: ‘x_mean’ was not declared in this scope; did you mean ‘cc_mean’? 64 | torch::Tensor x = ((torch::tensor({60.0, 30000.0, -2.3, 0.3, 2.5}) - x_mean) / x_std).to(torch::kFloat); // batch_size=1, feature_dim=5 | ^~~~~~ | cc_mean /home/chenjiayi/code/params-tuning/deploy/inference.cpp:89:10: error: ‘void dx’ has incomplete type 89 | auto dx = optimize_input(x, c, y, pt_path, st); | ^~ make[2]: *** [CMakeFiles/inference.dir/build.make:79:CMakeFiles/inference.dir/inference.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:87:CMakeFiles/inference.dir/all] 错误 2 make: *** [Makefile:91:all] 错误 2
最新发布
06-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值