libtorch-bin: init at 1.6.0

This commit is contained in:
Daniël de Kok
2020-08-30 13:22:09 +02:00
parent 5f8d0e4d75
commit 35e19d22c1
6 changed files with 167 additions and 0 deletions
@@ -0,0 +1,4 @@
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
add_executable(test test.cpp)
target_link_libraries(test "${TORCH_LIBRARIES}")
@@ -0,0 +1,26 @@
{ stdenv, cmake, libtorch-bin, symlinkJoin }:
stdenv.mkDerivation {
pname = "libtorch-test";
version = libtorch-bin.version;
src = ./.;
postPatch = ''
cat CMakeLists.txt
'';
makeFlags = [ "VERBOSE=1" ];
nativeBuildInputs = [ cmake ];
buildInputs = [ libtorch-bin ];
installPhase = ''
touch $out
'';
checkPhase = ''
./test
'';
}
@@ -0,0 +1,7 @@
#include <torch/torch.h>
#include <iostream>
int main() {
torch::Tensor tensor = torch::eye(3);
std::cout << tensor << std::endl;
}