2020-06-24 07:52:44 +00:00
|
|
|
{ lib
|
2020-08-15 13:15:48 +00:00
|
|
|
, stdenv
|
2020-01-31 20:30:02 +00:00
|
|
|
, buildDunePackage
|
|
|
|
, fetchFromGitHub
|
2023-03-23 20:27:56 +00:00
|
|
|
, fetchpatch
|
2020-01-31 20:30:02 +00:00
|
|
|
, cmdliner
|
|
|
|
, ctypes
|
2020-12-12 15:36:41 +00:00
|
|
|
, dune-configurator
|
2020-01-31 20:30:02 +00:00
|
|
|
, npy
|
|
|
|
, ocaml-compiler-libs
|
|
|
|
, ppx_custom_printf
|
|
|
|
, ppx_expect
|
|
|
|
, ppx_sexp_conv
|
|
|
|
, sexplib
|
|
|
|
, stdio
|
2022-08-30 15:41:22 +00:00
|
|
|
, torch
|
2020-01-31 20:30:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "torch";
|
2023-02-09 07:10:37 +00:00
|
|
|
version = "0.17";
|
2020-12-12 15:36:41 +00:00
|
|
|
|
2023-02-09 07:10:37 +00:00
|
|
|
duneVersion = "3";
|
2021-08-22 20:37:32 +00:00
|
|
|
minimalOCamlVersion = "4.08";
|
2020-01-31 20:30:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-06-24 07:52:44 +00:00
|
|
|
owner = "LaurentMazare";
|
2023-03-23 20:27:56 +00:00
|
|
|
repo = "ocaml-${pname}";
|
|
|
|
rev = version;
|
2023-02-09 07:10:37 +00:00
|
|
|
hash = "sha256-z/9NUBjeFWE63Z/e8OyzDiy8hrn6qzjaiBH8G9MPeos=";
|
2020-01-31 20:30:02 +00:00
|
|
|
};
|
|
|
|
|
2023-03-23 20:27:56 +00:00
|
|
|
patches = [
|
|
|
|
# Pytorch 2.0 support. Drop when it reaches a release
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/LaurentMazare/ocaml-torch/commit/ef7ef30cafecb09e45ec1ed8ce4bedae5947cfa5.patch";
|
|
|
|
hash = "sha256-smdwKy40iIISp/25L2J4az6KmqFS1soeChBElUyhl5A=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-12-12 15:36:41 +00:00
|
|
|
buildInputs = [ dune-configurator ];
|
|
|
|
|
2020-01-31 20:30:02 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cmdliner
|
|
|
|
ctypes
|
|
|
|
npy
|
|
|
|
ocaml-compiler-libs
|
|
|
|
ppx_custom_printf
|
|
|
|
ppx_expect
|
|
|
|
ppx_sexp_conv
|
|
|
|
sexplib
|
|
|
|
stdio
|
2022-08-30 15:41:22 +00:00
|
|
|
torch
|
|
|
|
torch.dev
|
2020-01-31 20:30:02 +00:00
|
|
|
];
|
|
|
|
|
2022-08-30 15:41:22 +00:00
|
|
|
preBuild = "export LIBTORCH=${torch.dev}/";
|
2020-01-31 20:30:02 +00:00
|
|
|
|
2020-08-15 13:15:48 +00:00
|
|
|
doCheck = !stdenv.isAarch64;
|
2020-01-31 20:30:02 +00:00
|
|
|
checkPhase = "dune runtest";
|
|
|
|
|
2020-06-24 07:52:44 +00:00
|
|
|
meta = with lib; {
|
2020-01-31 20:30:02 +00:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
description = "Ocaml bindings to Pytorch";
|
|
|
|
maintainers = [ maintainers.bcdarwin ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|