anchor.diff:    '' + lib.optionalString (cudaSupport && cudnn != null) ''
       export CUDNN_INCLUDE_DIR=${cudnn}/include
     '';
  -
  -  patches = [
  -    # Prevents a race condition which would be introduced by pull 30333.
  -    # See https://github.com/pytorch/pytorch/issues/32277
  -    # Can be removed >1.5.0.
  -    (fetchpatch {
  -      url = "https://patch-diff.githubusercontent.com/raw/pytorch/pytorch/pull/30332.patch";
  -      sha256 = "1v9dwbhz3rdxcx6sz8y8j9n3bj6nqs78b1r8yg89yc15n6l4cqx2";
  -    })
  -
  -    # Fixes errors with gcc-9 compilation. Cherry-picked on advice from ezyang.
  -    # See https://github.com/pytorch/pytorch/issues/32277
  -    # Can be removed >1.5.0.
  -    (fetchpatch {
  -      url = "https://patch-diff.githubusercontent.com/raw/pytorch/pytorch/pull/30333.patch";
  -      sha256 = "139413fl37h2fnil0cv99a67mqqnsh02k74b92by1qyr6pcfyg3q";
  -    })
  -  ];
   
     # Use pytorch's custom configurations
     dontUseCmakeConfigure = true;
  
positive.code:     "LD_LIBRARY_PATH=${cudaStub}\${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH ";
  
  in buildPythonPackage rec {
    version = "1.4.1";
    pname = "pytorch";
    disabled = !isPy3k;
  
  
negative.code:     repo   = "pytorch";
      rev    = "v${version}";
      fetchSubmodules = true;
      sha256 = "19qyrjd72mc0llcfn50av8ym05f2iwa38gv068wykji4ph7qjlv2";
    };
  
    preConfigure = lib.optionalString cudaSupport ''
  