about summary refs log tree commit diff
path: root/pkgs/development/python-modules/einops/default.nix
blob: 18b8d671c98af7d4d4e657a717093047c09ecbe9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ lib
, fetchFromGitHub
, buildPythonPackage
, numpy
, nose
, nbformat
, nbconvert
, jupyter
, chainer
, pytorch
, mxnet
, tensorflow
, keras
}:

buildPythonPackage rec {
  pname = "einops";
  version = "0.3.2";

  src = fetchFromGitHub {
    owner = "arogozhnikov";
    repo = pname;
    rev = "v${version}";
    sha256 = "0ix094cfh6w4bvx6ymp5dpm35y9nkaibcn1y50g6kwdp4f0473y8";
  };

  checkInputs = [
    nose
    numpy
    # For notebook tests
    nbformat
    nbconvert
    jupyter
    # For backend tests
    chainer
    pytorch
    mxnet
    tensorflow
    keras
  ];

  # No CUDA in sandbox
  EINOPS_SKIP_CUPY = 1;

  checkPhase = ''
    export HOME=$TMPDIR

    # Prevent hangs on PyTorch-related tests, see
    # https://discuss.pytorch.org/t/pytorch-cpu-hangs-on-nn-linear/17748/4
    export OMP_NUM_THREADS=1

    nosetests -v -w tests
  '';

  meta = {
    description = "Flexible and powerful tensor operations for readable and reliable code";
    homepage = "https://github.com/arogozhnikov/einops";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ yl3dy ];
  };
}