libtorch-bin: init at 1.6.0
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user