anchor.diff:      "LD_LIBRARY_PATH=${cudaStub}\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ";
   
   in buildPythonPackage rec {
  -  version = "1.0.0";
  +  version = "1.2.0";
     pname = "pytorch";
     disabled = !isPy3k;
  +
  +  outputs = [
  +    "out"   # output standard python package
  +    "dev"   # output libtorch only
  +  ];
   
     src = fetchFromGitHub {
       owner  = "pytorch";
       repo   = "pytorch";
       rev    = "v${version}";
       fetchSubmodules = true;
  -    sha256 = "076cpbig4sywn9vv674c0xdg832sdrd5pk1d0725pjkm436kpvlm";
  +    sha256 = "1biyq2p48chakf2xw7hazzqmr5ps1nx475ql8vkmxjg5zaa071cz";
     };
   
  -  patches =
  -    [ # Skips two tests that are only meant to run on multi GPUs
  -      (fetchurl {
  -        url = "https://github.com/pytorch/pytorch/commit/bfa666eb0deebac21b03486e26642fd70d66e478.patch";
  -        sha256 = "1fgblcj02gjc0y62svwc5gnml879q3x2z7m69c9gax79dpr37s9i";
  -      })
  -    ];
  -
     dontUseCmakeConfigure = true;
  +
     preConfigure = lib.optionalString cudaSupport ''
  +    export TORCH_CUDA_ARCH_LIST="${lib.strings.concatStringsSep ";" final_cudaArchList}"
       export CC=${cudatoolkit.cc}/bin/gcc CXX=${cudatoolkit.cc}/bin/g++
     '' + lib.optionalString (cudaSupport && cudnn != null) ''
       export CUDNN_INCLUDE_DIR=${cudnn}/include
  
positive.code:   PYTORCH_BUILD_VERSION = version;
    PYTORCH_BUILD_NUMBER = 0;
  
    # Suppress a weird warning in mkl-dnn, part of ideep in pytorch
    # (upstream seems to have fixed this in the wrong place?)
    # https://github.com/intel/mkl-dnn/commit/8134d346cdb7fe1695a2aa55771071d455fae0bc
    NIX_CFLAGS_COMPILE = lib.optionals (numpy.blasImplementation == "mkl") [ "-Wno-error=array-bounds" ];
  
    nativeBuildInputs = [
       cmake
       utillinux
       which
    ] ++ lib.optionals cudaSupport [ cudatoolkit_joined ];
  
    buildInputs = [
       numpy.blas
    ] ++ lib.optionals cudaSupport [ cudnn ]
      ++ lib.optionals stdenv.isLinux [ numactl ];
  
    propagatedBuildInputs = [
      cffi
      numpy
      pyyaml
    ] ++ lib.optional (pythonOlder "3.5") typing;
  
    checkInputs = [ hypothesis ];
    checkPhase = ''
      ${cudaStubEnv}python test/run_test.py --exclude dataloader sparse torch utils thd_distributed distributed cpp_extensions
    '';
  
    meta = {
      description = "Open source, prototype-to-production deep learning platform";
      homepage    = https://pytorch.org/;
      license     = lib.licenses.bsd3;
      platforms   = lib.platforms.linux;
      maintainers = with lib.maintainers; [ teh thoughtpolice ];
    };
  }
  
negative.code:       RP_NEW=$(join_by : ''${RP[@]:2})
        patchelf --set-rpath \$ORIGIN:''${RP_NEW} "$1"
      }
      for f in $(find ''${out} -name 'libcaffe2*.so')
      do
        strip2 $f
  