C++ frontend error while saving tensor.

Hello, I’m trying to save tensor in c++ frontend.
My torchlib version is 1.0.0.dev20190225

My c++ code based on doc https://pytorch.org/cppdocs/api/function_namespacetorch_1a99dc9f736064b2179cc58e6436f7a021.html:

  #include <torch/script.h>
  #include <ATen/ATen.h>
  #include <iostream>
  #include <memory>
  int main(int argc, const char* argv[]) {
  auto tensor = torch::ones({num_of_tags, num_of_tags});  
  torch::save(tensor, "./tensor.t");

After build i’ve get an error:

vlad@user-MS-7B61:/media/data/notebooks/Tretyak/experiments/flair_production/experiments/example-app/build$ make
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
/media/data/notebooks/Tretyak/experiments/flair_production/experiments/example-app/example-app.cpp: In function ‘int main(int, const char**)’:
/media/data/notebooks/Tretyak/experiments/flair_production/experiments/example-app/example-app.cpp:21:5: error: ‘save’ is not a member of ‘torch’
     torch::save(tensor, "./tensor.t");
CMakeFiles/example-app.dir/build.make:62: recipe for target 'CMakeFiles/example-app.dir/example-app.cpp.o' failed
make[2]: *** [CMakeFiles/example-app.dir/example-app.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/example-app.dir/all' failed
make[1]: *** [CMakeFiles/example-app.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Does this method exists?
I get the same error using torch::load() that error: ‘load’ is not a member of ‘torch’

And I also have a question. Is it possible to save tensor in python frontend and load it in c++ frontend?
Thank you.

If you add #include <torch/torch.h>, then torch::save() and torch::load() should work.

We are still working on the ability to save tensor in python frontend and load it in c++ frontend.