diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test')
3 files changed, 18 insertions, 8 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/CMakeLists.txt b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/CMakeLists.txt index b302449ef772..4e96704a4c17 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/CMakeLists.txt +++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/CMakeLists.txt @@ -1,3 +1,4 @@ +cmake_minimum_required(VERSION 3.0) find_package(Torch REQUIRED) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}") add_executable(test test.cpp) diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/default.nix b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/default.nix index d661ec28db98..e69807871f46 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/default.nix +++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/default.nix @@ -6,16 +6,12 @@ stdenv.mkDerivation { src = ./.; - postPatch = '' - cat CMakeLists.txt - ''; - - makeFlags = [ "VERBOSE=1" ]; - nativeBuildInputs = [ cmake ]; buildInputs = [ libtorch-bin ]; + doCheck = true; + installPhase = '' touch $out ''; diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/test.cpp b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/test.cpp index 5537724ce5f6..ca238fba521d 100644 --- a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/test.cpp +++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/libtorch/test/test.cpp @@ -1,7 +1,20 @@ -#include <torch/torch.h> +#undef NDEBUG +#include <cassert> + #include <iostream> +#include <torch/torch.h> + int main() { torch::Tensor tensor = torch::eye(3); - std::cout << tensor << std::endl; + + float checkData[] = { + 1, 0, 0, + 0, 1, 0, + 0, 0, 1 + }; + + torch::Tensor check = torch::from_blob(checkData, {3, 3}); + + assert(tensor.allclose(check)); } |