2020-06-24 08:52:44 +01:00
|
|
|
{ lib
|
2020-08-15 14:15:48 +01:00
|
|
|
, stdenv
|
2020-01-31 20:30:02 +00:00
|
|
|
, buildDunePackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, 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
|
|
|
|
, pytorch
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "torch";
|
2021-03-11 08:00:32 +00:00
|
|
|
version = "0.12";
|
2020-01-31 20:30:02 +00:00
|
|
|
|
2020-12-12 15:36:41 +00:00
|
|
|
useDune2 = true;
|
|
|
|
|
|
|
|
minimumOCamlVersion = "4.08";
|
2020-01-31 20:30:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-06-24 08:52:44 +01:00
|
|
|
owner = "LaurentMazare";
|
2020-01-31 20:30:02 +00:00
|
|
|
repo = "ocaml-${pname}";
|
|
|
|
rev = version;
|
2021-03-11 08:00:32 +00:00
|
|
|
sha256 = "0nl6hd2rivhgkc3sdkdmrk3j0ij3xjx1clhqm8m5iznir4g77g91";
|
2020-01-31 20:30:02 +00:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
pytorch
|
|
|
|
pytorch.dev
|
|
|
|
ppx_custom_printf
|
|
|
|
ppx_expect
|
|
|
|
ppx_sexp_conv
|
|
|
|
sexplib
|
|
|
|
stdio
|
|
|
|
];
|
|
|
|
|
2021-01-24 09:19:10 +00:00
|
|
|
preBuild = "export LIBTORCH=${pytorch.dev}/";
|
2020-01-31 20:30:02 +00:00
|
|
|
|
2020-08-15 14:15:48 +01:00
|
|
|
doCheck = !stdenv.isAarch64;
|
2020-01-31 20:30:02 +00:00
|
|
|
checkPhase = "dune runtest";
|
|
|
|
|
2020-06-24 08:52:44 +01: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;
|
|
|
|
};
|
|
|
|
}
|