#Trying to use libtorch with windows and getting compiler errors

5 messages · Page 1 of 1 (latest)

dense spoke
#

I'm trying to use the Pytorch rust wrapper and am trying to learn the library to use in a project. But, I get a many compilation errors and I'm not sure exactly where it went wrong.

Here is the code I'm using (This is rust btw)

use tch::Tensor;

fn main() {
    let t = Tensor::from_slice(&[3, 1, 4, 1, 5]);
    let t = t * 2;
    t.print();
}

I am using a Windows computer and have installed libtorch to my computer and added it to my path already.
https://pytorch.org/
I've installed the Stable Windows LibTorch C++ CPU version.

Here is the crates page.
https://crates.io/crates/tch/0.16.0

carmine pawnBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

dense spoke
#

This is the last part of error

  exit code: 1
  cargo:warning=ToolExecError: Command "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "C:\\libtorch\\include" "-I" "C:\\libtorch\\include/torch/csrc/api/include" "/std:c++17" "-o" "C:\\Users\\Admin\\Desktop\\nn_test\\target\\debug\\build\\torch-sys-337149dd09e3a81c\\out\\19072f24a82f85ae-torch_api.o" "-c" "libtch/torch_api.cpp" with args g++.exe did not execute successfully (status code exit code: 1).
  exit code: 1
  cargo:warning=ToolExecError: Command "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "C:\\libtorch\\include" "-I" "C:\\libtorch\\include/torch/csrc/api/include" "/std:c++17" "-o" "C:\\Users\\Admin\\Desktop\\nn_test\\target\\debug\\build\\torch-sys-337149dd09e3a81c\\out\\19072f24a82f85ae-torch_api_generated.o" "-c" "libtch/torch_api_generated.cpp" with args g++.exe did not execute successfully (status code exit code: 1).

  --- stderr


  error occurred: Command "g++.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-I" "C:\\libtorch\\include" "-I" "C:\\libtorch\\include/torch/csrc/api/include" "/std:c++17" "-o" "C:\\Users\\Admin\\Desktop\\nn_test\\target\\debug\\build\\torch-sys-337149dd09e3a81c\\out\\19072f24a82f85ae-torch_api_generated.o" "-c" "libtch/torch_api_generated.cpp" with args g++.exe did not execute successfully (status code exit code: 1).
#

This error is impossible to understand and I'm not sure what I need to do to solve it

dense spoke
#

!solved