Where is libATen.so in pytorch

Guys, I wanna extend pytorch using C++, however, in my python env, I cannot find libATen.so which will be used for at::Tensor in C++? I installed pytorch by "conda install -c pytorch pytorch ". Donot tell me to install from pytorch source, thanks.

As pytorch is based on C++/C, there should be a library + header files, while I found header files of ATen related in “lib/python3.6/site-packages/torch/lib/include/ATen” but NOT the library. Help!

Hello there, I think ATen is part of the libtorch.so. This article may help: https://pytorch.org/tutorials/advanced/cpp_extension.html

You may for example create a minimal project. In your CMakeLists.txt:

cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)

find_package(Torch REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main ${TORCH_LIBRARIES})

In your main.cpp:

// #include <torch/torch.h> // You could of course also include everything.
#include <ATen/ATen.h>

using namespace at;

int main(int argc, char** argv) {

	Tensor a = ones({2, 2}, kInt);
	Tensor b = randn({2, 2});

	auto c = a + b.to(kInt);

	return 0;
}

Hope it helps, although a little late, but maybe for future readers. I have to admit that I don’t know whether this works for the stable binaries right now. I compiled PyTorch from the master branch on GitHub.