Hello,
I followed the instructions for building libtorch as a shared library, then successfully compiled and ran a simple program on Linux -
#include <ATen/ATen.h>
at::Tensor a = at::ones({2, 2}, at::kInt);
at::Tensor b = at::randn({2, 2});
auto c = a + b.to(at::kInt);
Next I compiled libtorch as a static library and successfully compiled it with my simple program. However it crashes when run -
terminate called after throwing an instance of 'c10::Error'
what(): Could not find schema for aten::ones.
Exception raised from findSchemaOrThrow at ../aten/src/ATen/core/dispatch/Dispatcher.cpp:81
(gdb) bt
#0 c10::Dispatcher::findSchemaOrThrow (
this=0x555555e4b860 <c10::Dispatcher::singleton()::_singleton>,
name=0x555555a67762 "aten::ones", overload_name=0x555555a655b8 "")
at ../aten/src/ATen/core/dispatch/Dispatcher.cpp:81
#1 0x000055555559fc75 in at::ones (size=..., options=...) at aten/src/ATen/Functions.cpp:4390
#2 0x000055555557a181 in main () at /home/shane/dev/aten_libtorch/aten_min.cpp:4
Here is my CMake script
Does anyone know why?