diff --git a/build/makepatch.sh b/build/makepatch.sh new file mode 100644 index 0000000000000000000000000000000000000000..4a8041b3cd329d3bf71ba00446ab48070ebadf77 --- /dev/null +++ b/build/makepatch.sh @@ -0,0 +1 @@ +diff -Nur --exclude=.git* --exclude=.jenkins --exclude=android --exclude=OWNERS --exclude=third_party --exclude=README* -Nur pytorch-v1.5.0 pytorch-develop >npu.patch diff --git a/build/mkdirs.sh b/build/mkdirs.sh index 7065a5a64f7743b83b2447c215a8c563f1cfc559..2ff3f15ae109c91767785111bf0ed6c3fd26f190 100644 --- a/build/mkdirs.sh +++ b/build/mkdirs.sh @@ -2,6 +2,8 @@ CUR_DIR=$(dirname $(readlink -f $0)) ROOT_DIR=$CUR_DIR/.. +SRC_DIR=pytorch-develop + # mkdir src mkdir -p src/aten/src/ATen/native mkdir -p src/aten/src/ATen/detail @@ -24,42 +26,40 @@ mkdir -p src/tools/autograd mkdir -p temp/test # move files -mv pytorch/aten/src/ATen/native/npu src/aten/src/ATen/native -mv pytorch/aten/src/THNPU src/aten/src -mv pytorch/aten/src/ATen/detail/NPU* src/aten/src/ATen/detail -mv pytorch/aten/src/ATen/npu src/aten/src/ATen -mv pytorch/aten/src/ATen/templates/NPU* src/aten/src/ATen/templates -cp pytorch/aten/src/ATen/native/native_functions.yaml src/aten/src/ATen/native -cp pytorch/tools/autograd/derivatives.yaml src/tools/autograd - -mv pytorch/c10/npu src/c10 - -mv pytorch/cmake/public/npu.cmake src/cmake/public - -mv pytorch/third_party/acl src/third_party -mv pytorch/third_party/hccl src/third_party - -mv pytorch/torch/contrib/npu src/torch/contrib -mv pytorch/torch/csrc/autograd/profiler_npu.cpp src/torch/csrc/autograd -mv pytorch/torch/csrc/npu src/torch/csrc -mv pytorch/torch/csrc/utils/npu_* src/torch/csrc/utils -mv pytorch/torch/npu src/torch -mv pytorch/torch/lib/c10d/HCCL* src/torch/lib/c10d -mv pytorch/torch/lib/c10d/ProcessGroupHCCL* src/torch/lib/c10d - -mv pytorch/env.sh src -mv pytorch/build.sh src # where -mv pytorch/README.en.md src # no need -mv pytorch/README.zh.md src # no need +mv $SRC_DIR/aten/src/ATen/native/npu src/aten/src/ATen/native +mv $SRC_DIR/aten/src/THNPU src/aten/src +mv $SRC_DIR/aten/src/ATen/detail/NPU* src/aten/src/ATen/detail +mv $SRC_DIR/aten/src/ATen/npu src/aten/src/ATen +mv $SRC_DIR/aten/src/ATen/templates/NPU* src/aten/src/ATen/templates +cp $SRC_DIR/aten/src/ATen/native/native_functions.yaml src/aten/src/ATen/native +cp $SRC_DIR/tools/autograd/derivatives.yaml src/tools/autograd + +mv $SRC_DIR/c10/npu src/c10 + +mv $SRC_DIR/cmake/public/npu.cmake src/cmake/public + +mv $SRC_DIR/third_party/acl src/third_party +mv $SRC_DIR/third_party/hccl src/third_party + +mv $SRC_DIR/torch/contrib/npu src/torch/contrib +mv $SRC_DIR/torch/csrc/autograd/profiler_npu.cpp src/torch/csrc/autograd +mv $SRC_DIR/torch/csrc/npu src/torch/csrc +mv $SRC_DIR/torch/csrc/utils/npu_* src/torch/csrc/utils +mv $SRC_DIR/torch/npu src/torch +mv $SRC_DIR/torch/lib/c10d/HCCL* src/torch/lib/c10d +mv $SRC_DIR/torch/lib/c10d/ProcessGroupHCCL* src/torch/lib/c10d + +mv $SRC_DIR/env.sh src +mv $SRC_DIR/build.sh src # where ## fuzzy compile -mv pytorch/aten/src/ATen/native/GlobalStep* src/aten/src/ATen/native +mv $SRC_DIR/aten/src/ATen/native/GlobalStep* src/aten/src/ATen/native ## dump util -mv pytorch/aten/src/ATen/utils src/aten/src/ATen -mv pytorch/torch/utils/dumper.py src/torch/utils +mv $SRC_DIR/aten/src/ATen/utils src/aten/src/ATen +mv $SRC_DIR/torch/utils/dumper.py src/torch/utils # end mv src temp -mv pytorch/test/test_npu temp/test -mv pytorch/access_control_test.py temp +mv $SRC_DIR/test/test_npu temp/test +mv $SRC_DIR/access_control_test.py temp diff --git a/patch/npu.patch b/patch/npu.patch index b071d62201202adf40a240f8067747f1bb76871b..5c7fa69d23b0705a6b5dda56e75ef804a3ff2321 100644 --- a/patch/npu.patch +++ b/patch/npu.patch @@ -1,6 +1,6 @@ -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/CMakeLists.txt CODE/pytorch/aten/CMakeLists.txt ---- pytorch/aten/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/CMakeLists.txt 2021-06-17 11:41:07.957765450 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/CMakeLists.txt pytorch-develop/aten/CMakeLists.txt +--- pytorch-v1.5.0/aten/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/CMakeLists.txt 2021-06-25 16:37:35.486258833 +0800 @@ -22,8 +22,10 @@ set(ATen_CPU_INCLUDE) set(ATen_THIRD_PARTY_INCLUDE) @@ -49,9 +49,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= set(ATen_HIP_INCLUDE ${ATen_HIP_INCLUDE} PARENT_SCOPE) set(ATen_THIRD_PARTY_INCLUDE ${ATen_THIRD_PARTY_INCLUDE} PARENT_SCOPE) set(ATen_CPU_DEPENDENCY_LIBS ${ATen_CPU_DEPENDENCY_LIBS} PARENT_SCOPE) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/CMakeLists.txt CODE/pytorch/aten/src/ATen/CMakeLists.txt ---- pytorch/aten/src/ATen/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/CMakeLists.txt 2021-06-17 11:41:07.957765450 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/CMakeLists.txt pytorch-develop/aten/src/ATen/CMakeLists.txt +--- pytorch-v1.5.0/aten/src/ATen/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/CMakeLists.txt 2021-06-25 16:37:35.486258833 +0800 @@ -67,6 +67,9 @@ FILE(GLOB native_quantized_h "native/quantized/*.h" "native/quantized/cpu/*.h") FILE(GLOB native_cpu_h "native/cpu/*.h") @@ -127,9 +127,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= set(ATen_NVRTC_STUB_SRCS ${ATen_NVRTC_STUB_SRCS} PARENT_SCOPE) set(ATen_HIP_SRCS ${ATen_HIP_SRCS} PARENT_SCOPE) set(ATen_QUANTIZED_SRCS ${ATen_QUANTIZED_SRCS} PARENT_SCOPE) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/core/dispatch/DispatchTable.h CODE/pytorch/aten/src/ATen/core/dispatch/DispatchTable.h ---- pytorch/aten/src/ATen/core/dispatch/DispatchTable.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/core/dispatch/DispatchTable.h 2021-06-17 11:41:07.965765511 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/core/dispatch/DispatchTable.h pytorch-develop/aten/src/ATen/core/dispatch/DispatchTable.h +--- pytorch-v1.5.0/aten/src/ATen/core/dispatch/DispatchTable.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/core/dispatch/DispatchTable.h 2021-06-25 16:37:35.494258894 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -168,9 +168,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } catchallKernel_ = std::move(kernel); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/function_wrapper.py CODE/pytorch/aten/src/ATen/function_wrapper.py ---- pytorch/aten/src/ATen/function_wrapper.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/function_wrapper.py 2021-06-17 11:41:07.973765572 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/function_wrapper.py pytorch-develop/aten/src/ATen/function_wrapper.py +--- pytorch-v1.5.0/aten/src/ATen/function_wrapper.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/function_wrapper.py 2021-06-25 16:37:35.502258955 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -353,9 +353,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= for declaration in declarations: for option in declaration['options']: -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/gen.py CODE/pytorch/aten/src/ATen/gen.py ---- pytorch/aten/src/ATen/gen.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/gen.py 2021-06-17 11:41:07.973765572 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/gen.py pytorch-develop/aten/src/ATen/gen.py +--- pytorch-v1.5.0/aten/src/ATen/gen.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/gen.py 2021-06-25 16:37:35.502258955 +0800 @@ -1,3 +1,18 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -511,9 +511,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + npu_file_manager.write_outputs(options.output_dependencies + "-npu") else: generate_outputs() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/cpu/Activation.cpp CODE/pytorch/aten/src/ATen/native/cpu/Activation.cpp ---- pytorch/aten/src/ATen/native/cpu/Activation.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/cpu/Activation.cpp 2021-06-17 11:41:07.985765664 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/cpu/Activation.cpp pytorch-develop/aten/src/ATen/native/cpu/Activation.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/cpu/Activation.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/cpu/Activation.cpp 2021-06-25 16:37:35.514259047 +0800 @@ -339,20 +339,20 @@ void hardsigmoid_backward_kernel(TensorIterator& iter) { @@ -539,9 +539,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return Vec::blendv(kZeroVec, grad_val * kOneSixthVec, gradNonZeroMask); }); }); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/Memory.cpp CODE/pytorch/aten/src/ATen/native/Memory.cpp ---- pytorch/aten/src/ATen/native/Memory.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/Memory.cpp 2021-06-17 11:41:07.977765603 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/Memory.cpp pytorch-develop/aten/src/ATen/native/Memory.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/Memory.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/Memory.cpp 2021-06-25 16:37:35.506258986 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -594,9 +594,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= auto storage = Storage( self.dtype(), detail::computeStorageSize(self.sizes(), self.strides()), -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/native_functions.yaml CODE/pytorch/aten/src/ATen/native/native_functions.yaml ---- pytorch/aten/src/ATen/native/native_functions.yaml 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/native_functions.yaml 2021-06-24 11:19:42.289659227 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/native_functions.yaml pytorch-develop/aten/src/ATen/native/native_functions.yaml +--- pytorch-v1.5.0/aten/src/ATen/native/native_functions.yaml 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/native_functions.yaml 2021-06-25 16:37:35.526259138 +0800 @@ -1,6 +1,5 @@ # See README.md in this directory for more guidance @@ -6736,9 +6736,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + npu_dispatch_only: + NPU: normalize_batch_npu \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S CODE/pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S ---- pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S 2021-06-17 11:41:08.037766060 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S pytorch-develop/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S +--- pytorch-v1.5.0/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/quantized/cpu/qnnpack/src/q8gemm/8x8-dq-aarch64-neon.S 2021-06-25 16:37:35.566259444 +0800 @@ -659,14 +659,14 @@ SUB x1, x1, 4 @@ -6762,9 +6762,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= 5: CMP x1, 2 -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/TensorCompare.cpp CODE/pytorch/aten/src/ATen/native/TensorCompare.cpp ---- pytorch/aten/src/ATen/native/TensorCompare.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/TensorCompare.cpp 2021-06-17 11:41:07.981765633 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/TensorCompare.cpp pytorch-develop/aten/src/ATen/native/TensorCompare.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/TensorCompare.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/TensorCompare.cpp 2021-06-25 16:37:35.510259016 +0800 @@ -64,7 +64,7 @@ Tensor isinf(const Tensor &self) { @@ -6774,9 +6774,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return at::zeros_like(self, at::kBool, at::MemoryFormat::Preserve); } return AT_DISPATCH_FLOATING_TYPES_AND_HALF(self.scalar_type(), "isinf", [&]() { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/TensorFactories.cpp CODE/pytorch/aten/src/ATen/native/TensorFactories.cpp ---- pytorch/aten/src/ATen/native/TensorFactories.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/TensorFactories.cpp 2021-06-17 11:41:07.981765633 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/TensorFactories.cpp pytorch-develop/aten/src/ATen/native/TensorFactories.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/TensorFactories.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/TensorFactories.cpp 2021-06-25 16:37:35.510259016 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -6819,9 +6819,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } else { allocator = at::getCPUAllocator(); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/TensorProperties.cpp CODE/pytorch/aten/src/ATen/native/TensorProperties.cpp ---- pytorch/aten/src/ATen/native/TensorProperties.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/TensorProperties.cpp 2021-06-17 11:41:07.981765633 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/TensorProperties.cpp pytorch-develop/aten/src/ATen/native/TensorProperties.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/TensorProperties.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/TensorProperties.cpp 2021-06-25 16:37:35.510259016 +0800 @@ -87,6 +87,7 @@ if (self.is_contiguous(memory_format)) { return self; @@ -6830,9 +6830,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= TORCH_CHECK( memory_format != MemoryFormat::Preserve, "preserve memory format is unsupported by the contiguous operator"); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native/UpSampleBicubic2d.cpp CODE/pytorch/aten/src/ATen/native/UpSampleBicubic2d.cpp ---- pytorch/aten/src/ATen/native/UpSampleBicubic2d.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native/UpSampleBicubic2d.cpp 2021-06-17 11:41:07.985765664 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native/UpSampleBicubic2d.cpp pytorch-develop/aten/src/ATen/native/UpSampleBicubic2d.cpp +--- pytorch-v1.5.0/aten/src/ATen/native/UpSampleBicubic2d.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native/UpSampleBicubic2d.cpp 2021-06-25 16:37:35.514259047 +0800 @@ -26,7 +26,7 @@ const scalar_t* in = &idata[output_y * input_width + output_x]; scalar_t* out = &odata[output_y * output_width + output_x]; @@ -6842,9 +6842,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= out[0] = in[0]; in += input_width * input_height; out += output_width * output_height; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/native_parse.py CODE/pytorch/aten/src/ATen/native_parse.py ---- pytorch/aten/src/ATen/native_parse.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/native_parse.py 2021-06-17 11:41:08.049766152 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/native_parse.py pytorch-develop/aten/src/ATen/native_parse.py +--- pytorch-v1.5.0/aten/src/ATen/native_parse.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/native_parse.py 2021-06-25 16:37:35.582259566 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -6880,9 +6880,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= declarations.append(declaration) except Exception as e: msg = '''Exception raised in processing function: -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/preprocess_declarations.py CODE/pytorch/aten/src/ATen/preprocess_declarations.py ---- pytorch/aten/src/ATen/preprocess_declarations.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/preprocess_declarations.py 2021-06-17 11:41:08.049766152 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/preprocess_declarations.py pytorch-develop/aten/src/ATen/preprocess_declarations.py +--- pytorch-v1.5.0/aten/src/ATen/preprocess_declarations.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/preprocess_declarations.py 2021-06-25 16:37:35.582259566 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -6912,9 +6912,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= default_backends = ['CPU', 'CUDA'] -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/templates/TensorBody.h CODE/pytorch/aten/src/ATen/templates/TensorBody.h ---- pytorch/aten/src/ATen/templates/TensorBody.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/templates/TensorBody.h 2021-06-17 11:41:08.053766182 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/templates/TensorBody.h pytorch-develop/aten/src/ATen/templates/TensorBody.h +--- pytorch-v1.5.0/aten/src/ATen/templates/TensorBody.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/templates/TensorBody.h 2021-06-25 16:37:35.582259566 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -6945,9 +6945,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= /// Returns if a `Tensor` has HIP backend. bool is_hip() const; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/ATen/templates/TensorMethods.h CODE/pytorch/aten/src/ATen/templates/TensorMethods.h ---- pytorch/aten/src/ATen/templates/TensorMethods.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/ATen/templates/TensorMethods.h 2021-06-17 11:41:08.053766182 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/ATen/templates/TensorMethods.h pytorch-develop/aten/src/ATen/templates/TensorMethods.h +--- pytorch-v1.5.0/aten/src/ATen/templates/TensorMethods.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/ATen/templates/TensorMethods.h 2021-06-25 16:37:35.582259566 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -6979,9 +6979,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= inline NamedTensorMeta* Tensor::get_named_tensor_meta() { return static_cast(impl_->named_tensor_meta()); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/TH/CMakeLists.txt CODE/pytorch/aten/src/TH/CMakeLists.txt ---- pytorch/aten/src/TH/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/TH/CMakeLists.txt 2021-06-17 11:41:08.053766182 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/TH/CMakeLists.txt pytorch-develop/aten/src/TH/CMakeLists.txt +--- pytorch-v1.5.0/aten/src/TH/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/TH/CMakeLists.txt 2021-06-25 16:37:35.586259596 +0800 @@ -48,6 +48,11 @@ ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) @@ -6994,9 +6994,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= CONFIGURE_FILE(THGeneral.h.in "${CMAKE_CURRENT_BINARY_DIR}/THGeneral.h") -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/TH/generic/THStorage.cpp CODE/pytorch/aten/src/TH/generic/THStorage.cpp ---- pytorch/aten/src/TH/generic/THStorage.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/TH/generic/THStorage.cpp 2021-06-17 11:41:08.057766213 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/TH/generic/THStorage.cpp pytorch-develop/aten/src/TH/generic/THStorage.cpp +--- pytorch-v1.5.0/aten/src/TH/generic/THStorage.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/TH/generic/THStorage.cpp 2021-06-25 16:37:35.586259596 +0800 @@ -1,9 +1,32 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7103,9 +7103,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return THStorage_(data)(self)[idx]; } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/aten/src/TH/generic/THStorage.h CODE/pytorch/aten/src/TH/generic/THStorage.h ---- pytorch/aten/src/TH/generic/THStorage.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/aten/src/TH/generic/THStorage.h 2021-06-17 11:41:08.057766213 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/aten/src/TH/generic/THStorage.h pytorch-develop/aten/src/TH/generic/THStorage.h +--- pytorch-v1.5.0/aten/src/TH/generic/THStorage.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/aten/src/TH/generic/THStorage.h 2021-06-25 16:37:35.586259596 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7142,9 +7142,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= TH_API THStorage* THStorage_(newWithSize1)(scalar_t); TH_API THStorage* THStorage_(newWithMapping)(const char *filename, ptrdiff_t size, int flags); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/CMakeLists.txt CODE/pytorch/c10/CMakeLists.txt ---- pytorch/c10/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/CMakeLists.txt 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/CMakeLists.txt pytorch-develop/c10/CMakeLists.txt +--- pytorch-v1.5.0/c10/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/CMakeLists.txt 2021-06-25 16:37:35.598259688 +0800 @@ -63,6 +63,14 @@ message(STATUS "don't use NUMA") endif() @@ -7171,9 +7171,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if(USE_ROCM) # NB: This directory is generated by the HIPIFY script; it's # not checked in -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/Backend.h CODE/pytorch/c10/core/Backend.h ---- pytorch/c10/core/Backend.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/Backend.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/Backend.h pytorch-develop/c10/core/Backend.h +--- pytorch-v1.5.0/c10/core/Backend.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/Backend.h 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7266,9 +7266,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= default: return "UNKNOWN_BACKEND"; } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/Device.cpp CODE/pytorch/c10/core/Device.cpp ---- pytorch/c10/core/Device.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/Device.cpp 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/Device.cpp pytorch-develop/c10/core/Device.cpp +--- pytorch-v1.5.0/c10/core/Device.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/Device.cpp 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7306,9 +7306,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= }}; auto device = std::find_if( types.begin(), -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/Device.h CODE/pytorch/c10/core/Device.h ---- pytorch/c10/core/Device.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/Device.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/Device.h pytorch-develop/c10/core/Device.h +--- pytorch-v1.5.0/c10/core/Device.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/Device.h 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7341,9 +7341,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= /// Return true if the device is of CPU type. bool is_cpu() const noexcept { return type_ == DeviceType::CPU; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/DeviceType.cpp CODE/pytorch/c10/core/DeviceType.cpp ---- pytorch/c10/core/DeviceType.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/DeviceType.cpp 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/DeviceType.cpp pytorch-develop/c10/core/DeviceType.cpp +--- pytorch-v1.5.0/c10/core/DeviceType.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/DeviceType.cpp 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7381,9 +7381,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return true; default: return false; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/DeviceType.h CODE/pytorch/c10/core/DeviceType.h ---- pytorch/c10/core/DeviceType.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/DeviceType.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/DeviceType.h pytorch-develop/c10/core/DeviceType.h +--- pytorch-v1.5.0/c10/core/DeviceType.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/DeviceType.h 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7424,9 +7424,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= constexpr DeviceType kHIP = DeviceType::HIP; constexpr DeviceType kMSNPU = DeviceType::MSNPU; constexpr DeviceType kXLA = DeviceType::XLA; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/DispatchKey.cpp CODE/pytorch/c10/core/DispatchKey.cpp ---- pytorch/c10/core/DispatchKey.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/DispatchKey.cpp 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/DispatchKey.cpp pytorch-develop/c10/core/DispatchKey.cpp +--- pytorch-v1.5.0/c10/core/DispatchKey.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/DispatchKey.cpp 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7456,9 +7456,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= case DispatchKey::BackendSelect: return "BackendSelect"; case DispatchKey::TESTING_ONLY_GenericModeTensorId: -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/DispatchKey.h CODE/pytorch/c10/core/DispatchKey.h ---- pytorch/c10/core/DispatchKey.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/DispatchKey.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/DispatchKey.h pytorch-develop/c10/core/DispatchKey.h +--- pytorch-v1.5.0/c10/core/DispatchKey.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/DispatchKey.h 2021-06-25 16:37:35.598259688 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7488,9 +7488,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= PrivateUse2_TensorId, PrivateUse3_TensorId, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/Storage.h CODE/pytorch/c10/core/Storage.h ---- pytorch/c10/core/Storage.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/Storage.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/Storage.h pytorch-develop/c10/core/Storage.h +--- pytorch-v1.5.0/c10/core/Storage.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/Storage.h 2021-06-25 16:37:35.602259718 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7522,9 +7522,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= protected: c10::intrusive_ptr storage_impl_; }; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/StorageImpl.h CODE/pytorch/c10/core/StorageImpl.h ---- pytorch/c10/core/StorageImpl.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/StorageImpl.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/StorageImpl.h pytorch-develop/c10/core/StorageImpl.h +--- pytorch-v1.5.0/c10/core/StorageImpl.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/StorageImpl.h 2021-06-25 16:37:35.602259718 +0800 @@ -1,12 +1,39 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7579,9 +7579,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= bool received_cuda() { return received_cuda_; } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/TensorImpl.h CODE/pytorch/c10/core/TensorImpl.h ---- pytorch/c10/core/TensorImpl.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/TensorImpl.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/TensorImpl.h pytorch-develop/c10/core/TensorImpl.h +--- pytorch-v1.5.0/c10/core/TensorImpl.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/TensorImpl.h 2021-06-25 16:37:35.602259718 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7649,9 +7649,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= inline void set_pyobj(PyObject* pyobj) noexcept { pyobj_ = pyobj; } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/core/TensorOptions.h CODE/pytorch/c10/core/TensorOptions.h ---- pytorch/c10/core/TensorOptions.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/core/TensorOptions.h 2021-06-17 11:41:08.073766335 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/core/TensorOptions.h pytorch-develop/c10/core/TensorOptions.h +--- pytorch-v1.5.0/c10/core/TensorOptions.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/core/TensorOptions.h 2021-06-25 16:37:35.602259718 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7690,9 +7690,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } else { AT_ASSERTM(false, "Unknown DispatchKey: ", tid); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/c10/macros/Export.h CODE/pytorch/c10/macros/Export.h ---- pytorch/c10/macros/Export.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/c10/macros/Export.h 2021-06-17 11:41:08.077766365 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/c10/macros/Export.h pytorch-develop/c10/macros/Export.h +--- pytorch-v1.5.0/c10/macros/Export.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/c10/macros/Export.h 2021-06-25 16:37:35.602259718 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -7726,9 +7726,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= #if defined(TORCH_HIP_BUILD_MAIN_LIB) #define TORCH_HIP_API C10_EXPORT #else -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/caffe2/.clang-format CODE/pytorch/caffe2/.clang-format ---- pytorch/caffe2/.clang-format 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/caffe2/.clang-format 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/caffe2/.clang-format pytorch-develop/caffe2/.clang-format +--- pytorch-v1.5.0/caffe2/.clang-format 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/caffe2/.clang-format 1970-01-01 08:00:00.000000000 +0800 @@ -1,87 +0,0 @@ ---- -AccessModifierOffset: -1 @@ -7817,9 +7817,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -TabWidth: 8 -UseTab: Never -... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/caffe2/CMakeLists.txt CODE/pytorch/caffe2/CMakeLists.txt ---- pytorch/caffe2/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/caffe2/CMakeLists.txt 2021-06-17 11:41:08.085766427 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/caffe2/CMakeLists.txt pytorch-develop/caffe2/CMakeLists.txt +--- pytorch-v1.5.0/caffe2/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/caffe2/CMakeLists.txt 2021-06-25 16:37:35.610259779 +0800 @@ -32,6 +32,7 @@ # Add source, includes, and libs to lists list(APPEND Caffe2_CPU_SRCS ${ATen_CPU_SRCS}) @@ -7964,9 +7964,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # ---[ Caffe2 HIP sources. if(USE_ROCM) # Call again since Caffe2_HIP_INCLUDE is extended with ATen include dirs. -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/.clang-format CODE/pytorch/.clang-format ---- pytorch/.clang-format 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/.clang-format 2021-06-17 11:41:07.949765389 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/.clang-format pytorch-develop/.clang-format +--- pytorch-v1.5.0/.clang-format 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/.clang-format 2021-06-25 16:37:35.478258772 +0800 @@ -84,5 +84,4 @@ SpacesInSquareBrackets: false Standard: Cpp11 @@ -7975,9 +7975,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -... +UseTab: Never \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/cmake/BuildVariables.cmake CODE/pytorch/cmake/BuildVariables.cmake ---- pytorch/cmake/BuildVariables.cmake 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/cmake/BuildVariables.cmake 2021-06-17 11:41:08.197767281 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/cmake/BuildVariables.cmake pytorch-develop/cmake/BuildVariables.cmake +--- pytorch-v1.5.0/cmake/BuildVariables.cmake 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/cmake/BuildVariables.cmake 2021-06-25 16:37:35.722260634 +0800 @@ -11,6 +11,7 @@ # CMakeLists.txt files under each folder respectively. set(Caffe2_CPU_SRCS) @@ -8002,9 +8002,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # This variable contains dependency libraries of Caffe2 which requires whole # symbol linkage. One example is the onnx lib where we need all its schema # symbols. However, if the lib is whole linked in caffe2 lib, we don't want -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/cmake/Codegen.cmake CODE/pytorch/cmake/Codegen.cmake ---- pytorch/cmake/Codegen.cmake 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/cmake/Codegen.cmake 2021-06-17 11:41:08.197767281 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/cmake/Codegen.cmake pytorch-develop/cmake/Codegen.cmake +--- pytorch-v1.5.0/cmake/Codegen.cmake 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/cmake/Codegen.cmake 2021-06-25 16:37:35.722260634 +0800 @@ -191,13 +191,14 @@ file(READ ${CMAKE_BINARY_DIR}/aten/src/ATen/generated_cpp.txt generated_cpp) file(READ ${CMAKE_BINARY_DIR}/aten/src/ATen/generated_cpp.txt-cuda cuda_generated_cpp) @@ -8033,9 +8033,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= add_dependencies(ATEN_CUDA_FILES_GEN_LIB ATEN_CUDA_FILES_GEN_TARGET) + add_dependencies(ATEN_NPU_FILES_GEN_LIB ATEN_NPU_FILES_GEN_TARGET) endif() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/cmake/Dependencies.cmake CODE/pytorch/cmake/Dependencies.cmake ---- pytorch/cmake/Dependencies.cmake 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/cmake/Dependencies.cmake 2021-06-17 11:41:08.197767281 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/cmake/Dependencies.cmake pytorch-develop/cmake/Dependencies.cmake +--- pytorch-v1.5.0/cmake/Dependencies.cmake 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/cmake/Dependencies.cmake 2021-06-25 16:37:35.722260634 +0800 @@ -1509,6 +1509,13 @@ ENDIF(NOT C_HAS_THREAD) endif() @@ -8050,9 +8050,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # # End ATen checks # -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/cmake/Summary.cmake CODE/pytorch/cmake/Summary.cmake ---- pytorch/cmake/Summary.cmake 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/cmake/Summary.cmake 2021-06-17 11:41:08.201767312 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/cmake/Summary.cmake pytorch-develop/cmake/Summary.cmake +--- pytorch-v1.5.0/cmake/Summary.cmake 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/cmake/Summary.cmake 2021-06-25 16:37:35.722260634 +0800 @@ -134,6 +134,7 @@ if(NOT "${SELECTED_OP_LIST}" STREQUAL "") message(STATUS " SELECTED_OP_LIST : ${SELECTED_OP_LIST}") @@ -8061,9 +8061,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= message(STATUS " Public Dependencies : ${Caffe2_PUBLIC_DEPENDENCY_LIBS}") message(STATUS " Private Dependencies : ${Caffe2_DEPENDENCY_LIBS}") endfunction() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/cmake/TorchConfig.cmake.in CODE/pytorch/cmake/TorchConfig.cmake.in ---- pytorch/cmake/TorchConfig.cmake.in 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/cmake/TorchConfig.cmake.in 2021-06-17 11:41:08.201767312 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/cmake/TorchConfig.cmake.in pytorch-develop/cmake/TorchConfig.cmake.in +--- pytorch-v1.5.0/cmake/TorchConfig.cmake.in 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/cmake/TorchConfig.cmake.in 2021-06-25 16:37:35.722260634 +0800 @@ -112,6 +112,11 @@ list(APPEND TORCH_LIBRARIES ${TORCH_CUDA_LIBRARIES}) endif() @@ -8076,9 +8076,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # When we build libtorch with the old GCC ABI, dependent libraries must too. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set(TORCH_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=@GLIBCXX_USE_CXX11_ABI@") -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/CMakeLists.txt CODE/pytorch/CMakeLists.txt ---- pytorch/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/CMakeLists.txt 2021-06-17 11:41:07.953765419 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/CMakeLists.txt pytorch-develop/CMakeLists.txt +--- pytorch-v1.5.0/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/CMakeLists.txt 2021-06-25 16:37:35.482258803 +0800 @@ -205,6 +205,10 @@ option(USE_TBB "Use TBB" OFF) option(ONNX_ML "Enable traditional ONNX ML API." ON) @@ -8143,9 +8143,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if (APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-braces") -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/.dockerignore CODE/pytorch/.dockerignore ---- pytorch/.dockerignore 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/.dockerignore 2021-06-17 11:41:07.949765389 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/.dockerignore pytorch-develop/.dockerignore +--- pytorch-v1.5.0/.dockerignore 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/.dockerignore 2021-06-25 16:37:35.478258772 +0800 @@ -1,257 +1 @@ -# READ THIS BEFORE YOU REFACTOR ME -# @@ -8406,9 +8406,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -.clangd/ +.gitignore \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/docs/make.bat CODE/pytorch/docs/make.bat ---- pytorch/docs/make.bat 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/docs/make.bat 2021-06-17 11:41:08.205767342 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/docs/make.bat pytorch-develop/docs/make.bat +--- pytorch-v1.5.0/docs/make.bat 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/docs/make.bat 2021-06-25 16:37:35.730260695 +0800 @@ -1,36 +1,36 @@ -@ECHO OFF - @@ -8482,9 +8482,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + +:end +popd -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/ios/TestApp/.clang-format CODE/pytorch/ios/TestApp/.clang-format ---- pytorch/ios/TestApp/.clang-format 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/ios/TestApp/.clang-format 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/ios/TestApp/.clang-format pytorch-develop/ios/TestApp/.clang-format +--- pytorch-v1.5.0/ios/TestApp/.clang-format 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/ios/TestApp/.clang-format 1970-01-01 08:00:00.000000000 +0800 @@ -1,8 +0,0 @@ -BasedOnStyle: Google - @@ -8495,17 +8495,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -ColumnLimit: 100 -PointerBindsToType: false \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/README.md CODE/pytorch/README.md ---- pytorch/README.md 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/README.md 2021-06-17 11:41:07.953765419 +0800 -@@ -1,3 +1,4 @@ -+ - ![PyTorch Logo](https://github.com/pytorch/pytorch/blob/master/docs/source/_static/img/pytorch-logo-dark.png) - - -------------------------------------------------------------------------------- -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/requirements.txt CODE/pytorch/requirements.txt ---- pytorch/requirements.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/requirements.txt 2021-06-17 11:41:08.217767434 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/requirements.txt pytorch-develop/requirements.txt +--- pytorch-v1.5.0/requirements.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/requirements.txt 2021-06-25 16:37:35.742260786 +0800 @@ -4,4 +4,12 @@ requests setuptools @@ -8522,9 +8514,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +Pillow>=5.3.0 +torchvision \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/scripts/appveyor/install.bat CODE/pytorch/scripts/appveyor/install.bat ---- pytorch/scripts/appveyor/install.bat 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/scripts/appveyor/install.bat 2021-06-17 11:41:08.217767434 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/scripts/appveyor/install.bat pytorch-develop/scripts/appveyor/install.bat +--- pytorch-v1.5.0/scripts/appveyor/install.bat 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/scripts/appveyor/install.bat 2021-06-25 16:37:35.742260786 +0800 @@ -1,10 +1,10 @@ -:: Installation scripts for appveyor. - @@ -8546,9 +8538,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +set PATH=C:\Miniconda-x64;C:\Miniconda-x64\Scripts;%PATH% +:: Install numpy +conda install -y numpy -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/scripts/appveyor/install_cuda.bat CODE/pytorch/scripts/appveyor/install_cuda.bat ---- pytorch/scripts/appveyor/install_cuda.bat 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/scripts/appveyor/install_cuda.bat 2021-06-17 11:41:08.217767434 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/scripts/appveyor/install_cuda.bat pytorch-develop/scripts/appveyor/install_cuda.bat +--- pytorch-v1.5.0/scripts/appveyor/install_cuda.bat 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/scripts/appveyor/install_cuda.bat 2021-06-25 16:37:35.742260786 +0800 @@ -1,22 +1,22 @@ -@echo on - @@ -8594,9 +8586,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + +:: Make sure that nvcc is working correctly. +nvcc -V || exit /b -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/scripts/build_windows.bat CODE/pytorch/scripts/build_windows.bat ---- pytorch/scripts/build_windows.bat 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/scripts/build_windows.bat 2021-06-17 11:41:08.217767434 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/scripts/build_windows.bat pytorch-develop/scripts/build_windows.bat +--- pytorch-v1.5.0/scripts/build_windows.bat 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/scripts/build_windows.bat 2021-06-25 16:37:35.742260786 +0800 @@ -1,84 +1,84 @@ -:: ############################################################################# -:: Example command to build on Windows. @@ -8766,9 +8758,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +cd %ORIGINAL_DIR% +endlocal +exit /b 1 -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/scripts/proto.ps1 CODE/pytorch/scripts/proto.ps1 ---- pytorch/scripts/proto.ps1 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/scripts/proto.ps1 2021-06-17 11:41:08.217767434 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/scripts/proto.ps1 pytorch-develop/scripts/proto.ps1 +--- pytorch-v1.5.0/scripts/proto.ps1 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/scripts/proto.ps1 2021-06-25 16:37:35.742260786 +0800 @@ -1,17 +1,17 @@ -param( - [string]$protoc, @@ -8804,9 +8796,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + +$cmd = "$protoc -I${dir} --cpp_out=$out $processed" +Invoke-Expression $cmd -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/setup.py CODE/pytorch/setup.py ---- pytorch/setup.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/setup.py 2021-06-17 11:41:08.221767464 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/setup.py pytorch-develop/setup.py +--- pytorch-v1.5.0/setup.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/setup.py 2021-06-25 16:37:35.742260786 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -8902,9 +8894,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= ], 'caffe2': [ 'python/serialized_test/data/operator_test/*.zip', -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/derivatives.yaml CODE/pytorch/tools/autograd/derivatives.yaml ---- pytorch/tools/autograd/derivatives.yaml 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/derivatives.yaml 2021-06-24 11:19:42.293659258 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/derivatives.yaml pytorch-develop/tools/autograd/derivatives.yaml +--- pytorch-v1.5.0/tools/autograd/derivatives.yaml 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/derivatives.yaml 2021-06-25 16:37:36.894269574 +0800 @@ -107,6 +107,10 @@ # # NB: The parameter names here MUST be consistent with the parameter names @@ -9011,12 +9003,11 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +- name: npu_mish(Tensor self) -> Tensor + self: npu_mish_backward(grad, self) \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/gen_autograd_functions.py CODE/pytorch/tools/autograd/gen_autograd_functions.py ---- pytorch/tools/autograd/gen_autograd_functions.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/gen_autograd_functions.py 2021-06-17 11:41:09.357776130 +0800 -@@ -1,3 +1,19 @@ +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/dump_utils.py pytorch-develop/tools/autograd/dump_utils.py +--- pytorch-v1.5.0/tools/autograd/dump_utils.py 1970-01-01 08:00:00.000000000 +0800 ++++ pytorch-develop/tools/autograd/dump_utils.py 2021-06-25 16:37:36.894269574 +0800 +@@ -0,0 +1,112 @@ +# Copyright (c) 2021 Huawei Technologies Co., Ltd -+# Copyright (c) 2019, Facebook CORPORATION. +# All rights reserved. +# +# Licensed under the BSD 3-Clause License (the "License"); @@ -9031,49 +9022,159 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +# See the License for the specific language governing permissions and +# limitations under the License. + - # Generates C++ autograd functions for the derivatives of ATen operations - # - # This writes two files: -@@ -37,7 +53,37 @@ - IndexRangeGenerator gen; - ${compute_index_ranges} - variable_list grad_inputs(gen.size()); -- ${body} -+ ${body_define_vars} ++from .utils import CodeTemplate ++ ++PREPARE_TO_DUMP = CodeTemplate("""\ ++#ifdef USE_DUMP ++int seq_id = -1; ++bool dump_flag = false; ++bool load_flag = false; ++${define_ir_name} ++#endif ++""") ++ ++DUMP_INPUTS = CodeTemplate("""\ +#ifdef USE_DUMP -+ int seq_id = -1; -+ std::string ir_name("${op}"); -+ ${define_args_des} -+ bool load_flag = false; -+ if (LoadUtil::GetInstance()->CanLoadNow()) { ++${define_args_des} ++if (LoadUtil::GetInstance()->IsLoadSwitchOn()) { ++ LoadUtil::GetInstance()->Lock(); ++ if (!LoadUtil::GetInstance()->IsLoading()) { + LoadUtil::GetInstance()->SetLoadFlag(true); + LoadUtil::GetInstance()->LoadInputs(ir_name, ${args_des}); + ${scalar_args_copy} + seq_id = LoadUtil::GetInstance()->GetMatchedSeqId(); + load_flag = true; ++ } else { ++ LoadUtil::GetInstance()->Unlock(); + } -+ bool dump_flag = false; -+ if (DumpUtil::GetInstance()->CanDumpNow()) { ++} else if (DumpUtil::GetInstance()->IsDumpSwitchOn()) { ++ DumpUtil::GetInstance()->Lock(); ++ if (!DumpUtil::GetInstance()->IsDumping()) { + DumpUtil::GetInstance()->SetDumpFlag(true); + seq_id = DumpUtil::GetInstance()->DumpSeqIdAddOne(); + DumpUtil::GetInstance()->DumpInputs(ir_name, seq_id, ${args_des}); + dump_flag = true; ++ } else { ++ DumpUtil::GetInstance()->Unlock(); + } ++} +#endif ++""") + -+ ${body_derivative} ++DUMP_INPUTS_SKIP = """\ +#ifdef USE_DUMP -+ if (dump_flag || load_flag) { -+ ArgDes grad_inputs_des("grad_inputs", grad_inputs); -+ DumpUtil::GetInstance()->DumpOutputs(ir_name, seq_id, grad_inputs_des); -+ DumpUtil::GetInstance()->SetDumpFlag(false); -+ LoadUtil::GetInstance()->SetLoadFlag(false); ++if (LoadUtil::GetInstance()->IsLoadSwitchOn()) { ++ LoadUtil::GetInstance()->Lock(); ++ if (!LoadUtil::GetInstance()->IsLoading()) { ++ LoadUtil::GetInstance()->SetLoadFlag(true); ++ load_flag = true; ++ } else { ++ LoadUtil::GetInstance()->Unlock(); ++ } ++} else if (DumpUtil::GetInstance()->IsDumpSwitchOn()) { ++ DumpUtil::GetInstance()->Lock(); ++ if (!DumpUtil::GetInstance()->IsDumping()) { ++ DumpUtil::GetInstance()->SetDumpFlag(true); ++ dump_flag = true; ++ } else { ++ DumpUtil::GetInstance()->Unlock(); + } ++} ++#endif ++""" ++ ++DUMP_OUTPUTS = CodeTemplate("""\ ++#ifdef USE_DUMP ++if (dump_flag || load_flag) { ++ ${define_returns_des} ++ DumpUtil::GetInstance()->DumpOutputs(ir_name, seq_id, ${returns_des}); ++} ++#endif ++""") ++ ++DUMP_CLEAR_FLAG = CodeTemplate("""\ ++#ifdef USE_DUMP ++if (dump_flag) { ++ DumpUtil::GetInstance()->SetDumpFlag(false); ++ DumpUtil::GetInstance()->Unlock(); ++} else if (load_flag) { ++ LoadUtil::GetInstance()->SetLoadFlag(false); ++ LoadUtil::GetInstance()->Unlock(); ++} +#endif ++""") ++ ++BLACKLIST = [ ++ "MaxPool2DWithIndicesBackward", ++ "is_floating_point", ++ "to_dtype", ++ "to_dtype_layout", ++ "view", ++ "ViewBackward", ++ "t", ++ "TBackward", ++ "size_int", ++ "item", ++ "set__source_Storage_storage_offset", ++ "pin_memory", ++ "to_device" ++] +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/gen_autograd_functions.py pytorch-develop/tools/autograd/gen_autograd_functions.py +--- pytorch-v1.5.0/tools/autograd/gen_autograd_functions.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/gen_autograd_functions.py 2021-06-25 16:37:36.894269574 +0800 +@@ -1,3 +1,19 @@ ++# Copyright (c) 2021 Huawei Technologies Co., Ltd ++# Copyright (c) 2019, Facebook CORPORATION. ++# All rights reserved. ++# ++# Licensed under the BSD 3-Clause License (the "License"); ++# you may not use this file except in compliance with the License. ++# You may obtain a copy of the License at ++# ++# https://opensource.org/licenses/BSD-3-Clause ++# ++# Unless required by applicable law or agreed to in writing, software ++# distributed under the License is distributed on an "AS IS" BASIS, ++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++# See the License for the specific language governing permissions and ++# limitations under the License. ++ + # Generates C++ autograd functions for the derivatives of ATen operations + # + # This writes two files: +@@ -9,6 +25,7 @@ + from .utils import nested_dict, CodeTemplate, write + from .gen_autograd import VIEW_FUNCTIONS + from .utils import IDENT_REGEX ++from .dump_utils import PREPARE_TO_DUMP, DUMP_INPUTS, DUMP_INPUTS_SKIP, DUMP_OUTPUTS, DUMP_CLEAR_FLAG, BLACKLIST + + FUNCTION_DECLARATION = CodeTemplate("""\ + struct TORCH_API ${op} : public ${superclass} { +@@ -31,13 +48,22 @@ + } + """) + ++DEFINE_IR_NAME = CodeTemplate("""\ ++std::string ir_name("${op}"); ++""") ++ + FUNCTION_DEFINITION = CodeTemplate("""\ + variable_list ${op}::apply(variable_list&& grads) { + ${asserts} + IndexRangeGenerator gen; + ${compute_index_ranges} + variable_list grad_inputs(gen.size()); +- ${body} ++ ${body_define_vars} ++ ${prepare_to_dump} ++ ${dump_inputs} ++ ${body_derivative} ++ ${dump_outputs} ++ ${dump_clear_flag} return grad_inputs; } """) -@@ -120,7 +166,6 @@ +@@ -120,7 +146,6 @@ templated_output = CodeTemplate.from_file(os.path.join(template_path, f)) write(out, f, templated_output, top_env) @@ -9081,7 +9182,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def process_function(func): env = {} saved_variables = [] -@@ -128,15 +173,9 @@ +@@ -128,15 +153,9 @@ saved_list_sizes = [] unpack = [] asserts = [] @@ -9100,7 +9201,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def save_arg(arg, is_output): name = arg['name'] -@@ -147,6 +186,7 @@ +@@ -147,6 +166,7 @@ release_variables.append('{}_.reset_grad_function();'.format(name)) ptr = 'shared_from_this()' if is_output else '' unpack.append('auto {} = {}_.unpack({});'.format(name, name, ptr)) @@ -9108,7 +9209,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= elif arg['type'] == 'TensorList': saved_variables.append('std::vector {}_;'.format(name)) saved_variables.append('bool {}_released_ = false;'.format(name)) -@@ -156,12 +196,19 @@ +@@ -156,12 +176,19 @@ release_variables.append('{}_released_ = true;'.format(name)) unpack.append('auto {} = unpack_list({}_);'.format(name, name)) asserts.append('TORCH_CHECK(!{}_released_, ERR_BACKWARD_TWICE);'.format(name)) @@ -9128,7 +9229,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= for arg in func['saved_inputs']: save_arg(arg, is_output=False) -@@ -169,6 +216,19 @@ +@@ -169,6 +196,19 @@ save_arg(arg, is_output=True) env['saved_variables'] = saved_variables env['release_variables'] = release_variables @@ -9148,18 +9249,31 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= env['saved_list_sizes'] = saved_list_sizes env['asserts'] = asserts -@@ -177,10 +237,19 @@ +@@ -177,10 +217,32 @@ else: env['will_release_variables'] = '' - body = [] -+ env['define_args_des'] = define_args_des -+ env['scalar_args_copy'] = scalar_args_copy ++ define_ir_name = DEFINE_IR_NAME.substitute(func) ++ env['prepare_to_dump'] = PREPARE_TO_DUMP.substitute( ++ define_ir_name=define_ir_name) + -+ env['args_des'] = [] + args_des = ', '.join(arg_des_list) + args_des = args_des.rstrip(', ') -+ env['args_des'].append(args_des) ++ env['dump_inputs'] = DUMP_INPUTS.substitute( ++ define_args_des=define_args_des, ++ args_des=args_des, ++ scalar_args_copy=scalar_args_copy) ++ ++ env['dump_outputs'] = DUMP_OUTPUTS.substitute( ++ define_returns_des='ArgDes grad_inputs_des("grad_inputs", grad_inputs);', ++ returns_des='grad_inputs_des') ++ ++ env['dump_clear_flag'] = DUMP_CLEAR_FLAG.substitute() ++ ++ if func['op'] in BLACKLIST: ++ env['dump_inputs'] = DUMP_INPUTS_SKIP ++ env['dump_outputs'] = [] + + body_define_vars = [] + body_derivative = [] @@ -9170,7 +9284,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def emit_derivative(derivative): formula = derivative['formula'] -@@ -202,11 +271,12 @@ +@@ -202,11 +264,12 @@ derivative=formula, grad_input_mask=grad_input_mask) @@ -9186,14 +9300,14 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if func['name'] in UNTRACEABLE_FUNCTIONS: env['superclass'] = 'Node' else: -@@ -230,3 +300,4 @@ +@@ -230,3 +293,4 @@ def uses_single_grad(func): return uses_ident(func, 'grad') + -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/gen_python_functions.py CODE/pytorch/tools/autograd/gen_python_functions.py ---- pytorch/tools/autograd/gen_python_functions.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/gen_python_functions.py 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/gen_python_functions.py pytorch-develop/tools/autograd/gen_python_functions.py +--- pytorch-v1.5.0/tools/autograd/gen_python_functions.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/gen_python_functions.py 2021-06-25 16:37:36.894269574 +0800 @@ -1,3 +1,20 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -9233,9 +9347,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # and add to op arg map argmap['options'] = { 'value': argname, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/gen_variable_type.py CODE/pytorch/tools/autograd/gen_variable_type.py ---- pytorch/tools/autograd/gen_variable_type.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/gen_variable_type.py 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/gen_variable_type.py pytorch-develop/tools/autograd/gen_variable_type.py +--- pytorch-v1.5.0/tools/autograd/gen_variable_type.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/gen_variable_type.py 2021-06-25 16:37:36.894269574 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2021 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -9256,74 +9370,31 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # Generates VariableType.h/cpp # # VariableType is a subclass of at::Type that provides the binding code -@@ -26,6 +42,7 @@ +@@ -26,6 +42,8 @@ from .utils import CodeTemplate, nested_dict, write, uninplace_api_name from .gen_autograd import VIEW_FUNCTIONS from .gen_autograd_functions import uses_single_grad +from copy import deepcopy ++from .dump_utils import PREPARE_TO_DUMP, DUMP_INPUTS, DUMP_INPUTS_SKIP, DUMP_OUTPUTS, DUMP_CLEAR_FLAG, BLACKLIST # These functions we don't want to record for tracing, because we always want # to trace their constituent parts. This is a temporary hack in lieue -@@ -225,6 +242,54 @@ +@@ -225,6 +243,10 @@ CALL_DISPATCH_VIA_METHOD = CodeTemplate("""\ self_.${api_name}(${unpacked_method_args})""") -+PREPARE_TO_DUMP = CodeTemplate("""\ -+#ifdef USE_DUMP -+int seq_id = -1; -+bool dump_flag = false; -+bool load_flag = false; ++DEFINE_IR_NAME = CodeTemplate("""\ +std::string ir_name("${type_wrapper_name}"); -+#endif -+""") -+ -+DUMP_INPUTS = CodeTemplate("""\ -+#ifdef USE_DUMP -+${define_args_des} -+if (LoadUtil::GetInstance()->CanLoadNow()) { -+ LoadUtil::GetInstance()->SetLoadFlag(true); -+ LoadUtil::GetInstance()->LoadInputs(ir_name, ${args_des}); -+ ${scalar_args_copy} -+ seq_id = LoadUtil::GetInstance()->GetMatchedSeqId(); -+ load_flag = true; -+} -+if (DumpUtil::GetInstance()->CanDumpNow()) { -+ DumpUtil::GetInstance()->SetDumpFlag(true); -+ seq_id = DumpUtil::GetInstance()->DumpSeqIdAddOne(); -+ DumpUtil::GetInstance()->DumpInputs(ir_name, seq_id, ${args_des}); -+ dump_flag = true; -+} -+#endif -+""") -+ -+DUMP_OUTPUTS = CodeTemplate("""\ -+#ifdef USE_DUMP -+if (dump_flag || load_flag) { -+ ${define_returns_des} -+ DumpUtil::GetInstance()->DumpOutputs(ir_name, seq_id, ${returns_des}); -+ DumpUtil::GetInstance()->SetDumpFlag(false); -+ LoadUtil::GetInstance()->SetLoadFlag(false); -+} -+#endif -+""") -+ -+DUMP_NO_OUTPUTS = CodeTemplate("""\ -+#ifdef USE_DUMP -+if (dump_flag || load_flag) { -+ DumpUtil::GetInstance()->SetDumpFlag(false); -+ LoadUtil::GetInstance()->SetLoadFlag(false); -+} -+#endif +""") + # If the non-variable operation has return values, we use the `tmp` variable to hold the # values temporarily and pass the values to the return variables outside of the # `at::AutoNonVariableTypeMode` guard block. -@@ -676,6 +741,37 @@ +@@ -676,6 +698,40 @@ return setup -+ def emit_dump_inputs(): ++ def emit_dump_inputs(need_dump): + args_type = {} + for arg in declaration['arguments']: + arg_name = arg['name'] @@ -9348,16 +9419,19 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + + dump_inputs = '' + if len(args): -+ dump_inputs = DUMP_INPUTS.substitute( -+ define_args_des=define_args_des, -+ scalar_args_copy=scalar_args_copy, -+ args_des=args_des) ++ if need_dump: ++ dump_inputs = DUMP_INPUTS.substitute( ++ define_args_des=define_args_des, ++ scalar_args_copy=scalar_args_copy, ++ args_des=args_des) ++ else: ++ dump_inputs = DUMP_INPUTS_SKIP + return dump_inputs + def setup_derivative(differentiable_inputs): env = {} -@@ -837,6 +933,7 @@ +@@ -837,6 +893,7 @@ unpacked_method_args = combined['unpacked_args'][1:] base_type_call = CALL_DISPATCH_VIA_METHOD.substitute( combined, unpacked_method_args=unpacked_method_args) @@ -9365,7 +9439,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if not modifies_arguments and not returns_void: rhs_value = wrap_output('tmp') call = DISPATCH_TO_NON_VAR_TYPE_WITH_RETURN_VALUES.substitute( -@@ -876,6 +973,50 @@ +@@ -876,6 +933,50 @@ moved = ['std::move({})'.format(r['name']) for r in returns] return 'std::make_tuple({})'.format(', '.join(moved)) @@ -9416,36 +9490,39 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def emit_history(): fn = 'rebase' if modifies_arguments and view_info is None else 'set' output_names = [r['name'] for r in differentiable_outputs] -@@ -921,6 +1062,13 @@ +@@ -921,6 +1022,12 @@ input_names = record_function_input_names() body.append( RECORD_FUNCTION.substitute(combined, input_names=input_names)) -+ -+ prepare_to_dump = PREPARE_TO_DUMP.substitute(declaration) -+ body.append(prepare_to_dump) -+ -+ dump_inputs = emit_dump_inputs() -+ body.append(dump_inputs) ++ need_dump = declaration['type_wrapper_name'] not in BLACKLIST ++ ++ define_ir_name = DEFINE_IR_NAME.substitute(declaration) ++ body.append(PREPARE_TO_DUMP.substitute(define_ir_name=define_ir_name)) ++ body.append(emit_dump_inputs(need_dump)) + if strategy != 'use_type': body.extend(unpack_args(env, declaration)) if requires_derivative: -@@ -943,7 +1091,12 @@ +@@ -942,8 +1049,16 @@ + body.append(post_record_trace) if requires_derivative: body.append(emit_save_outputs()) ++ dump_clear_flag = DUMP_CLEAR_FLAG.substitute() if not returns_void: -+ dump_outputs = emit_dump_outputs() -+ body.append(dump_outputs) ++ if need_dump: ++ body.append(emit_dump_outputs()) ++ body.append(dump_clear_flag) ++ else: ++ body.append(dump_clear_flag) body.append('return {};'.format(get_return_value())) + else: -+ dump_no_outputs = DUMP_NO_OUTPUTS.substitute() -+ body.append(dump_no_outputs) ++ body.append(dump_clear_flag) return body -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/templates/Functions.cpp CODE/pytorch/tools/autograd/templates/Functions.cpp ---- pytorch/tools/autograd/templates/Functions.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/templates/Functions.cpp 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/templates/Functions.cpp pytorch-develop/tools/autograd/templates/Functions.cpp +--- pytorch-v1.5.0/tools/autograd/templates/Functions.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/templates/Functions.cpp 2021-06-25 16:37:36.894269574 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2021 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -9502,9 +9579,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= Tensor _sparse_addmm_sparse_backward(const Tensor& grad, const Tensor& sparse_, const Tensor& dense, const Scalar& alpha) { AT_ASSERT(sparse_.is_sparse()); auto sparse = sparse_.coalesce(); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/templates/python_torch_functions.cpp CODE/pytorch/tools/autograd/templates/python_torch_functions.cpp ---- pytorch/tools/autograd/templates/python_torch_functions.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/templates/python_torch_functions.cpp 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/templates/python_torch_functions.cpp pytorch-develop/tools/autograd/templates/python_torch_functions.cpp +--- pytorch-v1.5.0/tools/autograd/templates/python_torch_functions.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/templates/python_torch_functions.cpp 2021-06-25 16:37:36.894269574 +0800 @@ -22,7 +22,7 @@ #include "torch/csrc/autograd/generated/variable_factories.h" #include "torch/csrc/utils/structseq.h" @@ -9586,9 +9663,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= pybind11::gil_scoped_release no_gil; return torch::randint(low, high, size, options); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/templates/python_variable_methods.cpp CODE/pytorch/tools/autograd/templates/python_variable_methods.cpp ---- pytorch/tools/autograd/templates/python_variable_methods.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/templates/python_variable_methods.cpp 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/templates/python_variable_methods.cpp pytorch-develop/tools/autograd/templates/python_variable_methods.cpp +--- pytorch-v1.5.0/tools/autograd/templates/python_variable_methods.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/templates/python_variable_methods.cpp 2021-06-25 16:37:36.894269574 +0800 @@ -15,7 +15,13 @@ #include "torch/csrc/cuda/Stream.h" #include "torch/csrc/cuda/Event.h" @@ -9673,9 +9750,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= {"data_ptr", (PyCFunction)THPVariable_data_ptr, METH_NOARGS, NULL}, {"dim", (PyCFunction)THPVariable_dim, METH_NOARGS, NULL}, {"has_names", (PyCFunction)THPVariable_has_names, METH_NOARGS, NULL}, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/templates/VariableType.cpp CODE/pytorch/tools/autograd/templates/VariableType.cpp ---- pytorch/tools/autograd/templates/VariableType.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/templates/VariableType.cpp 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/templates/VariableType.cpp pytorch-develop/tools/autograd/templates/VariableType.cpp +--- pytorch-v1.5.0/tools/autograd/templates/VariableType.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/templates/VariableType.cpp 2021-06-25 16:37:36.894269574 +0800 @@ -1,7 +1,27 @@ +// Copyright (c) 2021 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -9704,9 +9781,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= // ${generated_comment} -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/autograd/templates/VariableType.h CODE/pytorch/tools/autograd/templates/VariableType.h ---- pytorch/tools/autograd/templates/VariableType.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/autograd/templates/VariableType.h 2021-06-24 11:19:42.293659258 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/autograd/templates/VariableType.h pytorch-develop/tools/autograd/templates/VariableType.h +--- pytorch-v1.5.0/tools/autograd/templates/VariableType.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/autograd/templates/VariableType.h 2021-06-25 16:37:36.894269574 +0800 @@ -1,3 +1,20 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -9736,9 +9813,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= at::Tensor & unpack(Tensor & t, const char * name, int pos); const at::Tensor & unpack(const Tensor & t, const char * name, int pos); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/tools/build_variables.bzl CODE/pytorch/tools/build_variables.bzl ---- pytorch/tools/build_variables.bzl 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/tools/build_variables.bzl 2021-06-17 11:41:09.357776130 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/tools/build_variables.bzl pytorch-develop/tools/build_variables.bzl +--- pytorch-v1.5.0/tools/build_variables.bzl 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/tools/build_variables.bzl 2021-06-25 16:37:36.894269574 +0800 @@ -46,6 +46,7 @@ "torch/csrc/autograd/functions/utils.cpp", "torch/csrc/autograd/input_buffer.cpp", @@ -9747,9 +9824,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= "torch/csrc/autograd/record_function.cpp", "torch/csrc/autograd/record_function_ops.cpp", "torch/csrc/autograd/saved_variable.cpp", -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/autograd/grad_mode.pyi CODE/pytorch/torch/autograd/grad_mode.pyi ---- pytorch/torch/autograd/grad_mode.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/autograd/grad_mode.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/autograd/grad_mode.pyi pytorch-develop/torch/autograd/grad_mode.pyi +--- pytorch-v1.5.0/torch/autograd/grad_mode.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/autograd/grad_mode.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,21 +0,0 @@ -from typing import Any, Callable, TypeVar - @@ -9772,9 +9849,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __init__(self, mode: bool) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, *args: Any) -> bool: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/autograd/__init__.pyi CODE/pytorch/torch/autograd/__init__.pyi ---- pytorch/torch/autograd/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/autograd/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/autograd/__init__.pyi pytorch-develop/torch/autograd/__init__.pyi +--- pytorch-v1.5.0/torch/autograd/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/autograd/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,46 +0,0 @@ -from typing import Any, Callable, Union, Tuple, Sequence, Optional -from .. import Tensor @@ -9822,9 +9899,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -_TensorOrTensors = Union[Tensor, Sequence[Tensor]] -def backward(tensors: _TensorOrTensors, grad_tensors: Optional[_TensorOrTensors]=..., retain_graph: Optional[bool]=..., create_graph: bool=...) -> None: ... -def grad(outputs: _TensorOrTensors, inputs: _TensorOrTensors, grad_outputs: Optional[_TensorOrTensors]=..., retain_graph: Optional[bool]=..., create_graph: bool=..., only_inputs: bool=..., allow_unused: bool=...) -> Tuple[Tensor, ...]: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/autograd/profiler.py CODE/pytorch/torch/autograd/profiler.py ---- pytorch/torch/autograd/profiler.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/autograd/profiler.py 2021-06-17 11:41:09.365776191 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/autograd/profiler.py pytorch-develop/torch/autograd/profiler.py +--- pytorch-v1.5.0/torch/autograd/profiler.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/autograd/profiler.py 2021-06-25 16:37:36.902269635 +0800 @@ -1,8 +1,25 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -10295,9 +10372,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if use_cuda: append("CUDA time total: {}".format(format_time(cuda_time_total))) return ''.join(result) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/CMakeLists.txt CODE/pytorch/torch/CMakeLists.txt ---- pytorch/torch/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/CMakeLists.txt 2021-06-17 11:41:09.361776160 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/CMakeLists.txt pytorch-develop/torch/CMakeLists.txt +--- pytorch-v1.5.0/torch/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/CMakeLists.txt 2021-06-25 16:37:36.898269605 +0800 @@ -97,6 +97,7 @@ ${TORCH_SRC_DIR}/csrc/tensor/python_tensor.cpp ${TORCH_SRC_DIR}/csrc/utils.cpp @@ -10327,9 +10404,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if (USE_NUMPY) list(APPEND TORCH_PYTHON_COMPILE_DEFINITIONS USE_NUMPY) endif() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/engine.cpp CODE/pytorch/torch/csrc/autograd/engine.cpp ---- pytorch/torch/csrc/autograd/engine.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/engine.cpp 2021-06-17 11:41:09.373776252 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/engine.cpp pytorch-develop/torch/csrc/autograd/engine.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/engine.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/engine.cpp 2021-06-25 16:37:36.910269696 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10450,9 +10527,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= const auto default_stream = guard.getDefaultStream(leaf_stream.device()); if (leaf_stream != default_stream) { auto event = c10::Event{c10::DeviceType::CUDA}; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/functions/tensor.cpp CODE/pytorch/torch/csrc/autograd/functions/tensor.cpp ---- pytorch/torch/csrc/autograd/functions/tensor.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/functions/tensor.cpp 2021-06-17 11:41:09.373776252 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/functions/tensor.cpp pytorch-develop/torch/csrc/autograd/functions/tensor.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/functions/tensor.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/functions/tensor.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10482,9 +10559,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= grad_inputs[1] = grad.to( src_options, /*non_blocking=*/false, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/init.cpp CODE/pytorch/torch/csrc/autograd/init.cpp ---- pytorch/torch/csrc/autograd/init.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/init.cpp 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/init.cpp pytorch-develop/torch/csrc/autograd/init.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/init.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/init.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10525,9 +10602,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= .def("shapes", &Event::shapes); m.def("_enable_profiler", enableProfiler); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/input_buffer.cpp CODE/pytorch/torch/csrc/autograd/input_buffer.cpp ---- pytorch/torch/csrc/autograd/input_buffer.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/input_buffer.cpp 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/input_buffer.cpp pytorch-develop/torch/csrc/autograd/input_buffer.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/input_buffer.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/input_buffer.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10577,9 +10654,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } auto& old_var = buffer[pos]; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/profiler.cpp CODE/pytorch/torch/csrc/autograd/profiler.cpp ---- pytorch/torch/csrc/autograd/profiler.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/profiler.cpp 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/profiler.cpp pytorch-develop/torch/csrc/autograd/profiler.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/profiler.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/profiler.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10773,9 +10850,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } CUDAStubs::~CUDAStubs() = default; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/profiler.h CODE/pytorch/torch/csrc/autograd/profiler.h ---- pytorch/torch/csrc/autograd/profiler.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/profiler.h 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/profiler.h pytorch-develop/torch/csrc/autograd/profiler.h +--- pytorch-v1.5.0/torch/csrc/autograd/profiler.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/profiler.h 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10898,9 +10975,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= TORCH_API void pushRange(std::string name); TORCH_API void popRange(); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/python_variable.cpp CODE/pytorch/torch/csrc/autograd/python_variable.cpp ---- pytorch/torch/csrc/autograd/python_variable.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/python_variable.cpp 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/python_variable.cpp pytorch-develop/torch/csrc/autograd/python_variable.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/python_variable.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/python_variable.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10952,9 +11029,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= {"is_sparse", (getter)THPVariable_is_sparse, nullptr, nullptr, nullptr}, {"is_mkldnn", (getter)THPVariable_is_mkldnn, nullptr, nullptr, nullptr}, {"is_complex", (getter)THPVariable_is_complex, nullptr, nullptr, nullptr}, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/python_variable_indexing.cpp CODE/pytorch/torch/csrc/autograd/python_variable_indexing.cpp ---- pytorch/torch/csrc/autograd/python_variable_indexing.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/python_variable_indexing.cpp 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/python_variable_indexing.cpp pytorch-develop/torch/csrc/autograd/python_variable_indexing.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/python_variable_indexing.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/python_variable_indexing.cpp 2021-06-25 16:37:36.914269727 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -10993,9 +11070,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } else { value = valueToTensor(self_.options(), py_value, self_device); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/utils/wrap_outputs.h CODE/pytorch/torch/csrc/autograd/utils/wrap_outputs.h ---- pytorch/torch/csrc/autograd/utils/wrap_outputs.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/utils/wrap_outputs.h 2021-06-17 11:41:09.377776283 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/utils/wrap_outputs.h pytorch-develop/torch/csrc/autograd/utils/wrap_outputs.h +--- pytorch-v1.5.0/torch/csrc/autograd/utils/wrap_outputs.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/utils/wrap_outputs.h 2021-06-25 16:37:36.914269727 +0800 @@ -168,6 +168,45 @@ return r.release(); } @@ -11042,9 +11119,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= inline PyObject* wrap(at::TensorList tl) { auto r = THPObjectPtr{PyTuple_New(tl.size())}; if (!r) throw python_error(); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/autograd/VariableTypeManual.cpp CODE/pytorch/torch/csrc/autograd/VariableTypeManual.cpp ---- pytorch/torch/csrc/autograd/VariableTypeManual.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/autograd/VariableTypeManual.cpp 2021-06-24 11:19:42.293659258 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/autograd/VariableTypeManual.cpp pytorch-develop/torch/csrc/autograd/VariableTypeManual.cpp +--- pytorch-v1.5.0/torch/csrc/autograd/VariableTypeManual.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/autograd/VariableTypeManual.cpp 2021-06-25 16:37:36.910269696 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11076,9 +11153,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= namespace { const Variable & checked_cast_variable(const Tensor & t, const char * name, int pos) { if (!t.defined()) { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/distributed/c10d/comm.cpp CODE/pytorch/torch/csrc/distributed/c10d/comm.cpp ---- pytorch/torch/csrc/distributed/c10d/comm.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/distributed/c10d/comm.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/distributed/c10d/comm.cpp pytorch-develop/torch/csrc/distributed/c10d/comm.cpp +--- pytorch-v1.5.0/torch/csrc/distributed/c10d/comm.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/distributed/c10d/comm.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11182,9 +11259,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } while (!in_flight.empty()) { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/distributed/c10d/init.cpp CODE/pytorch/torch/csrc/distributed/c10d/init.cpp ---- pytorch/torch/csrc/distributed/c10d/init.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/distributed/c10d/init.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/distributed/c10d/init.cpp pytorch-develop/torch/csrc/distributed/c10d/init.cpp +--- pytorch-v1.5.0/torch/csrc/distributed/c10d/init.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/distributed/c10d/init.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11239,9 +11316,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= shared_ptr_class_<::c10d::ProcessGroup::Work>(module, "Work") .def("is_completed", &::c10d::ProcessGroup::Work::isCompleted) .def("is_success", &::c10d::ProcessGroup::Work::isSuccess) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/distributed/c10d/reducer.cpp CODE/pytorch/torch/csrc/distributed/c10d/reducer.cpp ---- pytorch/torch/csrc/distributed/c10d/reducer.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/distributed/c10d/reducer.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/distributed/c10d/reducer.cpp pytorch-develop/torch/csrc/distributed/c10d/reducer.cpp +--- pytorch-v1.5.0/torch/csrc/distributed/c10d/reducer.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/distributed/c10d/reducer.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11364,9 +11441,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } } } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/DynamicTypes.cpp CODE/pytorch/torch/csrc/DynamicTypes.cpp ---- pytorch/torch/csrc/DynamicTypes.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/DynamicTypes.cpp 2021-06-17 11:41:09.365776191 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/DynamicTypes.cpp pytorch-develop/torch/csrc/DynamicTypes.cpp +--- pytorch-v1.5.0/torch/csrc/DynamicTypes.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/DynamicTypes.cpp 2021-06-25 16:37:36.902269635 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11413,9 +11490,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= auto it = attype_to_py_storage_type.find(attype); if (it != attype_to_py_storage_type.end()) { return it->second; -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/Generator.cpp CODE/pytorch/torch/csrc/Generator.cpp ---- pytorch/torch/csrc/Generator.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/Generator.cpp 2021-06-17 11:41:09.365776191 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/Generator.cpp pytorch-develop/torch/csrc/Generator.cpp +--- pytorch-v1.5.0/torch/csrc/Generator.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/Generator.cpp 2021-06-25 16:37:36.902269635 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11481,9 +11558,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= #else TORCH_INTERNAL_ASSERT(false, "PyTorch not compiled with CUDA"); #endif -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/generic/serialization.cpp CODE/pytorch/torch/csrc/generic/serialization.cpp ---- pytorch/torch/csrc/generic/serialization.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/generic/serialization.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/generic/serialization.cpp pytorch-develop/torch/csrc/generic/serialization.cpp +--- pytorch-v1.5.0/torch/csrc/generic/serialization.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/generic/serialization.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11581,9 +11658,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return storage.release(); } -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/generic/Storage.cpp CODE/pytorch/torch/csrc/generic/Storage.cpp ---- pytorch/torch/csrc/generic/Storage.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/generic/Storage.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/generic/Storage.cpp pytorch-develop/torch/csrc/generic/Storage.cpp +--- pytorch-v1.5.0/torch/csrc/generic/Storage.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/generic/Storage.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,7 +1,25 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11660,9 +11737,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= THPObjectPtr item; try { for (Py_ssize_t i = 0; i < length; i++) { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/generic/StorageMethods.cpp CODE/pytorch/torch/csrc/generic/StorageMethods.cpp ---- pytorch/torch/csrc/generic/StorageMethods.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/generic/StorageMethods.cpp 2021-06-17 11:41:09.381776313 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/generic/StorageMethods.cpp pytorch-develop/torch/csrc/generic/StorageMethods.cpp +--- pytorch-v1.5.0/torch/csrc/generic/StorageMethods.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/generic/StorageMethods.cpp 2021-06-25 16:37:36.918269757 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11708,9 +11785,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= {"data_ptr", (PyCFunction)THPStorage_(dataPtr), METH_NOARGS, nullptr}, {"is_pinned", (PyCFunction)THPStorage_(isPinned), METH_NOARGS, nullptr}, {"_write_file", (PyCFunction)THPStorage_(writeFile), METH_VARARGS, nullptr}, -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/Module.cpp CODE/pytorch/torch/csrc/Module.cpp ---- pytorch/torch/csrc/Module.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/Module.cpp 2021-06-17 11:41:09.365776191 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/Module.cpp pytorch-develop/torch/csrc/Module.cpp +--- pytorch-v1.5.0/torch/csrc/Module.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/Module.cpp 2021-06-25 16:37:36.902269635 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -11852,9 +11929,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= #endif auto set_module_attr = [&](const char* name, PyObject* v, bool incref = true) { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/tensor/python_tensor.cpp CODE/pytorch/torch/csrc/tensor/python_tensor.cpp ---- pytorch/torch/csrc/tensor/python_tensor.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/tensor/python_tensor.cpp 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/tensor/python_tensor.cpp pytorch-develop/torch/csrc/tensor/python_tensor.cpp +--- pytorch-v1.5.0/torch/csrc/tensor/python_tensor.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/tensor/python_tensor.cpp 2021-06-25 16:37:36.942269941 +0800 @@ -1,18 +1,35 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -12229,9 +12306,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -}} // namespace torch::tensors +} // namespace tensors +} // namespace torch -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/init.cpp CODE/pytorch/torch/csrc/utils/init.cpp ---- pytorch/torch/csrc/utils/init.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/init.cpp 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/init.cpp pytorch-develop/torch/csrc/utils/init.cpp +--- pytorch-v1.5.0/torch/csrc/utils/init.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/init.cpp 2021-06-25 16:37:36.942269941 +0800 @@ -1,6 +1,10 @@ #include #include @@ -12317,9 +12394,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + } +} } // namespace torch -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/init.h CODE/pytorch/torch/csrc/utils/init.h ---- pytorch/torch/csrc/utils/init.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/init.h 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/init.h pytorch-develop/torch/csrc/utils/init.h +--- pytorch-v1.5.0/torch/csrc/utils/init.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/init.h 2021-06-25 16:37:36.942269941 +0800 @@ -8,4 +8,7 @@ void initThroughputBenchmarkBindings(PyObject* module); @@ -12328,9 +12405,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + PyMethodDef* python_functions(); +} } // namespace torch -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/python_arg_parser.h CODE/pytorch/torch/csrc/utils/python_arg_parser.h ---- pytorch/torch/csrc/utils/python_arg_parser.h 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/python_arg_parser.h 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/python_arg_parser.h pytorch-develop/torch/csrc/utils/python_arg_parser.h +--- pytorch-v1.5.0/torch/csrc/utils/python_arg_parser.h 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/python_arg_parser.h 2021-06-25 16:37:36.942269941 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -12363,9 +12440,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= } const std::string &device_str = THPUtils_unpackString(args[i]); return at::Device(device_str); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/tensor_layouts.cpp CODE/pytorch/torch/csrc/utils/tensor_layouts.cpp ---- pytorch/torch/csrc/utils/tensor_layouts.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/tensor_layouts.cpp 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/tensor_layouts.cpp pytorch-develop/torch/csrc/utils/tensor_layouts.cpp +--- pytorch-v1.5.0/torch/csrc/utils/tensor_layouts.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/tensor_layouts.cpp 2021-06-25 16:37:36.942269941 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -12394,9 +12471,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= registerLayoutObject((THPLayout*)strided_layout, at::Backend::MSNPU); registerLayoutObject((THPLayout*)strided_layout, at::Backend::XLA); registerLayoutObject((THPLayout*)strided_layout, at::Backend::QuantizedCPU); -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/tensor_new.cpp CODE/pytorch/torch/csrc/utils/tensor_new.cpp ---- pytorch/torch/csrc/utils/tensor_new.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/tensor_new.cpp 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/tensor_new.cpp pytorch-develop/torch/csrc/utils/tensor_new.cpp +--- pytorch-v1.5.0/torch/csrc/utils/tensor_new.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/tensor_new.cpp 2021-06-25 16:37:36.942269941 +0800 @@ -1,3 +1,19 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -12530,9 +12607,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= " or ", c10::DispatchKey::XLATensorId, " but got: ", dispatch_key); } else if(expected_layout == c10::kSparse) { -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/csrc/utils/tensor_types.cpp CODE/pytorch/torch/csrc/utils/tensor_types.cpp ---- pytorch/torch/csrc/utils/tensor_types.cpp 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/csrc/utils/tensor_types.cpp 2021-06-24 11:19:42.293659258 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/csrc/utils/tensor_types.cpp pytorch-develop/torch/csrc/utils/tensor_types.cpp +--- pytorch-v1.5.0/torch/csrc/utils/tensor_types.cpp 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/csrc/utils/tensor_types.cpp 2021-06-25 16:37:36.942269941 +0800 @@ -1,58 +1,91 @@ +// Copyright (c) 2020 Huawei Technologies Co., Ltd +// Copyright (c) 2019, Facebook CORPORATION. @@ -12698,9 +12775,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -}} // namespace torch::utils +} // namespace utils +} // namespace torch -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/cuda/__init__.pyi CODE/pytorch/torch/cuda/__init__.pyi ---- pytorch/torch/cuda/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/cuda/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/cuda/__init__.pyi pytorch-develop/torch/cuda/__init__.pyi +--- pytorch-v1.5.0/torch/cuda/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/cuda/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,41 +0,0 @@ -from typing import Optional, Tuple, Union -from .. import device as _device @@ -12743,9 +12820,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -def reset_max_memory_cached(device: Optional[_device_t]=...) -> None: ... -def set_rng_state(new_state): ... -def get_rng_state(): ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/distributed/distributed_c10d.py CODE/pytorch/torch/distributed/distributed_c10d.py ---- pytorch/torch/distributed/distributed_c10d.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/distributed/distributed_c10d.py 2021-06-17 11:41:09.405776496 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/distributed/distributed_c10d.py pytorch-develop/torch/distributed/distributed_c10d.py +--- pytorch-v1.5.0/torch/distributed/distributed_c10d.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/distributed/distributed_c10d.py 2021-06-25 16:37:36.946269971 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -12824,9 +12901,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= else: raise RuntimeError("Unsupported distributed backend by group") -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/distributions/von_mises.py CODE/pytorch/torch/distributions/von_mises.py ---- pytorch/torch/distributions/von_mises.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/distributions/von_mises.py 2021-06-17 11:41:09.409776527 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/distributions/von_mises.py pytorch-develop/torch/distributions/von_mises.py +--- pytorch-v1.5.0/torch/distributions/von_mises.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/distributions/von_mises.py 2021-06-25 16:37:36.946269971 +0800 @@ -1,140 +1,140 @@ -from __future__ import absolute_import, division, print_function - @@ -13108,9 +13185,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + """ + return 1 - (_log_modified_bessel_fn(self.concentration, order=1) - + _log_modified_bessel_fn(self.concentration, order=0)).exp() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/__init__.py CODE/pytorch/torch/__init__.py ---- pytorch/torch/__init__.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/__init__.py 2021-06-17 11:41:09.361776160 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/__init__.py pytorch-develop/torch/__init__.py +--- pytorch-v1.5.0/torch/__init__.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/__init__.py 2021-06-25 16:37:36.898269605 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -13151,9 +13228,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= +#register npu shutdown hook on exit +atexit.register(_npu_shutdown) \ No newline at end of file -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/lib/c10d/CMakeLists.txt CODE/pytorch/torch/lib/c10d/CMakeLists.txt ---- pytorch/torch/lib/c10d/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/lib/c10d/CMakeLists.txt 2021-06-17 11:41:09.409776527 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/lib/c10d/CMakeLists.txt pytorch-develop/torch/lib/c10d/CMakeLists.txt +--- pytorch-v1.5.0/torch/lib/c10d/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/lib/c10d/CMakeLists.txt 2021-06-25 16:37:36.950270002 +0800 @@ -28,6 +28,10 @@ option(USE_C10D_NCCL "USE C10D NCCL" ON) endif() @@ -13204,9 +13281,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if(USE_C10D_MPI) target_include_directories(c10d PUBLIC ${MPI_INCLUDE_PATH}) copy_header(ProcessGroupMPI.hpp) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/lib/libshm/CMakeLists.txt CODE/pytorch/torch/lib/libshm/CMakeLists.txt ---- pytorch/torch/lib/libshm/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/lib/libshm/CMakeLists.txt 2021-06-17 11:41:09.413776557 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/lib/libshm/CMakeLists.txt pytorch-develop/torch/lib/libshm/CMakeLists.txt +--- pytorch-v1.5.0/torch/lib/libshm/CMakeLists.txt 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/lib/libshm/CMakeLists.txt 2021-06-25 16:37:36.950270002 +0800 @@ -37,8 +37,11 @@ SET_TARGET_PROPERTIES(shm PROPERTIES PREFIX "lib" @@ -13220,9 +13297,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= if(UNIX AND NOT APPLE) include(CheckLibraryExists) # https://github.com/libgit2/libgit2/issues/2128#issuecomment-35649830 -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/common_types.pyi CODE/pytorch/torch/nn/common_types.pyi ---- pytorch/torch/nn/common_types.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/common_types.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/common_types.pyi pytorch-develop/torch/nn/common_types.pyi +--- pytorch-v1.5.0/torch/nn/common_types.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/common_types.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,37 +0,0 @@ -from typing import TypeVar, Union, Tuple -from .. import Tensor @@ -13261,9 +13338,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -# With the proposed 'Literal' feature to Python typing, it might be possible to -# eventually eliminate this. -_maybe_indices_t = _scalar_or_tuple_2_t[Tensor] -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/functional.py CODE/pytorch/torch/nn/functional.py ---- pytorch/torch/nn/functional.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/functional.py 2021-06-17 11:41:09.413776557 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/functional.py pytorch-develop/torch/nn/functional.py +--- pytorch-v1.5.0/torch/nn/functional.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/functional.py 2021-06-25 16:37:36.954270032 +0800 @@ -1611,7 +1611,7 @@ else: output = input.matmul(weight.t()) @@ -13273,9 +13350,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= ret = output return ret -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/__init__.pyi CODE/pytorch/torch/nn/__init__.pyi ---- pytorch/torch/nn/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/__init__.pyi pytorch-develop/torch/nn/__init__.pyi +--- pytorch-v1.5.0/torch/nn/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,7 +0,0 @@ -from .modules import * -from .parameter import Parameter as Parameter @@ -13284,9 +13361,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -from . import utils as utils -from . import functional as functional -from . import parallel as parallel -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/modules/batchnorm.py CODE/pytorch/torch/nn/modules/batchnorm.py ---- pytorch/torch/nn/modules/batchnorm.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/modules/batchnorm.py 2021-06-17 11:41:09.417776588 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/modules/batchnorm.py pytorch-develop/torch/nn/modules/batchnorm.py +--- pytorch-v1.5.0/torch/nn/modules/batchnorm.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/modules/batchnorm.py 2021-06-25 16:37:36.954270032 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -13316,9 +13393,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= else: self.register_parameter('running_mean', None) self.register_parameter('running_var', None) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/modules/module.py CODE/pytorch/torch/nn/modules/module.py ---- pytorch/torch/nn/modules/module.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/modules/module.py 2021-06-17 11:41:09.417776588 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/modules/module.py pytorch-develop/torch/nn/modules/module.py +--- pytorch-v1.5.0/torch/nn/modules/module.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/modules/module.py 2021-06-25 16:37:36.954270032 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -13459,9 +13536,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def convert(t): if convert_to_format is not None and t.dim() == 4: return t.to(device, dtype if t.is_floating_point() else None, non_blocking, memory_format=convert_to_format) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/modules/normalization.py CODE/pytorch/torch/nn/modules/normalization.py ---- pytorch/torch/nn/modules/normalization.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/modules/normalization.py 2021-06-17 11:41:09.417776588 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/modules/normalization.py pytorch-develop/torch/nn/modules/normalization.py +--- pytorch-v1.5.0/torch/nn/modules/normalization.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/modules/normalization.py 2021-06-25 16:37:36.954270032 +0800 @@ -128,13 +128,14 @@ """ __constants__ = ['normalized_shape', 'eps', 'elementwise_affine'] @@ -13492,9 +13569,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def extra_repr(self): return '{normalized_shape}, eps={eps}, ' \ -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/modules/transformer.pyi.in CODE/pytorch/torch/nn/modules/transformer.pyi.in ---- pytorch/torch/nn/modules/transformer.pyi.in 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/modules/transformer.pyi.in 2021-06-17 11:41:09.417776588 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/modules/transformer.pyi.in pytorch-develop/torch/nn/modules/transformer.pyi.in +--- pytorch-v1.5.0/torch/nn/modules/transformer.pyi.in 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/modules/transformer.pyi.in 2021-06-25 16:37:36.954270032 +0800 @@ -1,60 +1,60 @@ -from ..init import xavier_uniform_ -from .activation import MultiheadAttention @@ -13616,18 +13693,18 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + activation: Any = ... + def __init__(self, d_model: Any, nhead: Any, dim_feedforward: int = ..., dropout: float = ..., activation: str = ...) -> None: ... + def forward(self, tgt: Any, memory: Any, tgt_mask: Optional[Any] = ..., memory_mask: Optional[Any] = ..., tgt_key_padding_mask: Optional[Any] = ..., memory_key_padding_mask: Optional[Any] = ...): ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/common_types.pyi CODE/pytorch/torch/nn/parallel/common_types.pyi ---- pytorch/torch/nn/parallel/common_types.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/common_types.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/common_types.pyi pytorch-develop/torch/nn/parallel/common_types.pyi +--- pytorch-v1.5.0/torch/nn/parallel/common_types.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/common_types.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Union, Sequence -from ... import device - -_device_t = Union[int, device] -_devices_t = Sequence[_device_t] -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/data_parallel.pyi CODE/pytorch/torch/nn/parallel/data_parallel.pyi ---- pytorch/torch/nn/parallel/data_parallel.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/data_parallel.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/data_parallel.pyi pytorch-develop/torch/nn/parallel/data_parallel.pyi +--- pytorch-v1.5.0/torch/nn/parallel/data_parallel.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/data_parallel.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,23 +0,0 @@ -from typing import Any, Optional, TypeVar -from .common_types import _devices_t, _device_t @@ -13652,9 +13729,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -def data_parallel(module: Module, inputs: Any, device_ids: Optional[_devices_t] = ..., - output_device: Optional[_device_t] = ..., dim: int = ..., - module_kwargs: Optional[Any] = ...) -> Tensor: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/distributed.py CODE/pytorch/torch/nn/parallel/distributed.py ---- pytorch/torch/nn/parallel/distributed.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/distributed.py 2021-06-17 11:41:09.417776588 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/distributed.py pytorch-develop/torch/nn/parallel/distributed.py +--- pytorch-v1.5.0/torch/nn/parallel/distributed.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/distributed.py 2021-06-25 16:37:36.958270063 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -13718,9 +13795,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= + assert self.is_cuda or self.is_npu, "SyncBatchNorm layers only work with CUDA or NPU modules" layer._specify_ddp_gpu_num( len(self.device_ids) if self.device_ids else 1) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/distributed.pyi CODE/pytorch/torch/nn/parallel/distributed.pyi ---- pytorch/torch/nn/parallel/distributed.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/distributed.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/distributed.pyi pytorch-develop/torch/nn/parallel/distributed.pyi +--- pytorch-v1.5.0/torch/nn/parallel/distributed.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/distributed.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,27 +0,0 @@ -from ..modules import Module -from typing import Any, Optional, TypeVar @@ -13749,18 +13826,18 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def forward(self, *inputs: Any, **kwargs: Any) -> T_co: ... - - def __call__(self, *inputs: Any, **kwargs: Any) -> T_co: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/__init__.pyi CODE/pytorch/torch/nn/parallel/__init__.pyi ---- pytorch/torch/nn/parallel/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/__init__.pyi pytorch-develop/torch/nn/parallel/__init__.pyi +--- pytorch-v1.5.0/torch/nn/parallel/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from .data_parallel import DataParallel as DataParallel, data_parallel as data_parallel -from .distributed import DistributedDataParallel as DistributedDataParallel -from .parallel_apply import parallel_apply as parallel_apply -from .replicate import replicate as replicate -from .scatter_gather import gather as gather, scatter as scatter -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/parallel_apply.pyi CODE/pytorch/torch/nn/parallel/parallel_apply.pyi ---- pytorch/torch/nn/parallel/parallel_apply.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/parallel_apply.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/parallel_apply.pyi pytorch-develop/torch/nn/parallel/parallel_apply.pyi +--- pytorch-v1.5.0/torch/nn/parallel/parallel_apply.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/parallel_apply.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,7 +0,0 @@ -from typing import Any, Optional, Sequence, List -from .common_types import _devices_t @@ -13769,9 +13846,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - -def parallel_apply(modules: Sequence[Module], inputs: Sequence[Any], kwargs_tup: Optional[Any] = ..., - devices: Optional[_devices_t] = ...) -> List[Any]: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/replicate.pyi CODE/pytorch/torch/nn/parallel/replicate.pyi ---- pytorch/torch/nn/parallel/replicate.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/replicate.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/replicate.pyi pytorch-develop/torch/nn/parallel/replicate.pyi +--- pytorch-v1.5.0/torch/nn/parallel/replicate.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/replicate.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,9 +0,0 @@ -from typing import List, Union, Sequence, TypeVar -from ..modules import Module @@ -13782,9 +13859,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - -def replicate(network: Module[T], devices: Union[_devices_t, Sequence[_devices_t]], detach: bool = ...) -> List[ - Module[T]]: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parallel/scatter_gather.pyi CODE/pytorch/torch/nn/parallel/scatter_gather.pyi ---- pytorch/torch/nn/parallel/scatter_gather.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parallel/scatter_gather.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parallel/scatter_gather.pyi pytorch-develop/torch/nn/parallel/scatter_gather.pyi +--- pytorch-v1.5.0/torch/nn/parallel/scatter_gather.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parallel/scatter_gather.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,24 +0,0 @@ -from typing import Any, Dict, List, Tuple, overload, TypeVar -from ... import Tensor @@ -13810,9 +13887,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - - -def gather(outputs: Any, target_device: _device_t, dim: int = ...) -> Any: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/parameter.pyi CODE/pytorch/torch/nn/parameter.pyi ---- pytorch/torch/nn/parameter.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/parameter.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/parameter.pyi pytorch-develop/torch/nn/parameter.pyi +--- pytorch-v1.5.0/torch/nn/parameter.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/parameter.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,7 +0,0 @@ -from .. import Tensor -import builtins @@ -13821,9 +13898,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __init__(self, data: Tensor=..., requires_grad: builtins.bool=...): ... - - ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/clip_grad.pyi CODE/pytorch/torch/nn/utils/clip_grad.pyi ---- pytorch/torch/nn/utils/clip_grad.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/clip_grad.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/clip_grad.pyi pytorch-develop/torch/nn/utils/clip_grad.pyi +--- pytorch-v1.5.0/torch/nn/utils/clip_grad.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/clip_grad.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,10 +0,0 @@ -from typing import Union, Iterable -from ... import Tensor @@ -13835,9 +13912,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - - -def clip_grad_value_(parameters: _tensor_or_tensors, clip_value: float): ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/convert_parameters.pyi CODE/pytorch/torch/nn/utils/convert_parameters.pyi ---- pytorch/torch/nn/utils/convert_parameters.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/convert_parameters.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/convert_parameters.pyi pytorch-develop/torch/nn/utils/convert_parameters.pyi +--- pytorch-v1.5.0/torch/nn/utils/convert_parameters.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/convert_parameters.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,8 +0,0 @@ -from typing import Iterable -from ... import Tensor @@ -13847,18 +13924,18 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - - -def vector_to_parameters(vec: Tensor, parameters: Iterable[Tensor]) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/__init__.pyi CODE/pytorch/torch/nn/utils/__init__.pyi ---- pytorch/torch/nn/utils/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/__init__.pyi pytorch-develop/torch/nn/utils/__init__.pyi +--- pytorch-v1.5.0/torch/nn/utils/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from .clip_grad import clip_grad_norm_ as clip_grad_norm_, clip_grad_value_ as clip_grad_value_ -from .convert_parameters import parameters_to_vector as parameters_to_vector, \ - vector_to_parameters as vector_to_parameters -from .spectral_norm import remove_spectral_norm as remove_spectral_norm, spectral_norm as spectral_norm -from .weight_norm import remove_weight_norm as remove_weight_norm, weight_norm as weight_norm -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/rnn.pyi CODE/pytorch/torch/nn/utils/rnn.pyi ---- pytorch/torch/nn/utils/rnn.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/rnn.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/rnn.pyi pytorch-develop/torch/nn/utils/rnn.pyi +--- pytorch-v1.5.0/torch/nn/utils/rnn.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/rnn.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,74 +0,0 @@ -from collections import namedtuple -from typing import Any, Optional, overload, Union, TypeVar, Tuple, Sequence @@ -13934,9 +14011,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - -def get_packed_sequence(data: Tensor, batch_sizes: Optional[Tensor], sorted_indices: Optional[Tensor], - unsorted_indices: Optional[Tensor]) -> PackedSequence: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/spectral_norm.pyi CODE/pytorch/torch/nn/utils/spectral_norm.pyi ---- pytorch/torch/nn/utils/spectral_norm.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/spectral_norm.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/spectral_norm.pyi pytorch-develop/torch/nn/utils/spectral_norm.pyi +--- pytorch-v1.5.0/torch/nn/utils/spectral_norm.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/spectral_norm.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,33 +0,0 @@ -from typing import Any, Optional, TypeVar -from ... import Tensor @@ -13971,9 +14048,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - - -def remove_spectral_norm(module: T_module, name: str = ...) -> T_module: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/nn/utils/weight_norm.pyi CODE/pytorch/torch/nn/utils/weight_norm.pyi ---- pytorch/torch/nn/utils/weight_norm.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/nn/utils/weight_norm.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/nn/utils/weight_norm.pyi pytorch-develop/torch/nn/utils/weight_norm.pyi +--- pytorch-v1.5.0/torch/nn/utils/weight_norm.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/nn/utils/weight_norm.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,28 +0,0 @@ -from typing import Any, TypeVar -from ..modules import Module @@ -14003,9 +14080,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - - -def remove_weight_norm(module: T_module, name: str = ...) -> T_module: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/onnx/symbolic_opset9.py CODE/pytorch/torch/onnx/symbolic_opset9.py ---- pytorch/torch/onnx/symbolic_opset9.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/onnx/symbolic_opset9.py 2021-06-17 11:41:09.421776618 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/onnx/symbolic_opset9.py pytorch-develop/torch/onnx/symbolic_opset9.py +--- pytorch-v1.5.0/torch/onnx/symbolic_opset9.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/onnx/symbolic_opset9.py 2021-06-25 16:37:36.958270063 +0800 @@ -1621,14 +1621,23 @@ slices = [sym_help._slice_helper(g, w, axes=[0], starts=[x * n], ends=[y * n]) for x, y in intervals] return g.op('Concat', *slices, axis_i=0) @@ -14063,27 +14140,27 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= state_indices = 2 * i, 2 * i + 2 -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adadelta.pyi CODE/pytorch/torch/optim/adadelta.pyi ---- pytorch/torch/optim/adadelta.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adadelta.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adadelta.pyi pytorch-develop/torch/optim/adadelta.pyi +--- pytorch-v1.5.0/torch/optim/adadelta.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adadelta.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class Adadelta(Optimizer): - def __init__(self, params: _params_t, lr: float=..., rho: float=..., eps: float=..., weight_decay: float=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adagrad.pyi CODE/pytorch/torch/optim/adagrad.pyi ---- pytorch/torch/optim/adagrad.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adagrad.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adagrad.pyi pytorch-develop/torch/optim/adagrad.pyi +--- pytorch-v1.5.0/torch/optim/adagrad.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adagrad.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class Adagrad(Optimizer): - def __init__(self, params: _params_t, lr: float=..., lr_decay: float=..., weight_decay: float=..., initial_accumulator_value: float=..., eps: float=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adamax.py CODE/pytorch/torch/optim/adamax.py ---- pytorch/torch/optim/adamax.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adamax.py 2021-06-17 11:41:09.421776618 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adamax.py pytorch-develop/torch/optim/adamax.py +--- pytorch-v1.5.0/torch/optim/adamax.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adamax.py 2021-06-25 16:37:36.958270063 +0800 @@ -80,8 +80,8 @@ exp_inf.mul_(beta2).unsqueeze(0), grad.abs().add_(eps).unsqueeze_(0) @@ -14095,45 +14172,45 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= bias_correction = 1 - beta1 ** state['step'] clr = group['lr'] / bias_correction -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adamax.pyi CODE/pytorch/torch/optim/adamax.pyi ---- pytorch/torch/optim/adamax.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adamax.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adamax.pyi pytorch-develop/torch/optim/adamax.pyi +--- pytorch-v1.5.0/torch/optim/adamax.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adamax.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class Adamax(Optimizer): - def __init__(self, params: _params_t, lr: float=..., betas: Tuple[float, float]=..., eps: float=..., weight_decay: float=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adam.pyi CODE/pytorch/torch/optim/adam.pyi ---- pytorch/torch/optim/adam.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adam.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adam.pyi pytorch-develop/torch/optim/adam.pyi +--- pytorch-v1.5.0/torch/optim/adam.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adam.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class Adam(Optimizer): - def __init__(self, params: _params_t, lr: float=..., betas: Tuple[float, float]=..., eps: float=..., weight_decay: float=..., amsgrad: bool = ...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/adamw.pyi CODE/pytorch/torch/optim/adamw.pyi ---- pytorch/torch/optim/adamw.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/adamw.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/adamw.pyi pytorch-develop/torch/optim/adamw.pyi +--- pytorch-v1.5.0/torch/optim/adamw.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/adamw.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class AdamW(Optimizer): - def __init__(self, params: _params_t, lr: float=..., betas: Tuple[float, float]=..., eps: float=..., weight_decay: float=..., amsgrad: bool = ...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/asgd.pyi CODE/pytorch/torch/optim/asgd.pyi ---- pytorch/torch/optim/asgd.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/asgd.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/asgd.pyi pytorch-develop/torch/optim/asgd.pyi +--- pytorch-v1.5.0/torch/optim/asgd.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/asgd.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class ASGD(Optimizer): - def __init__(self, params: _params_t, lr: float=..., lambd: float=..., alpha: float=..., t0: float=..., weight_decay: float=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/__init__.pyi CODE/pytorch/torch/optim/__init__.pyi ---- pytorch/torch/optim/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/__init__.pyi pytorch-develop/torch/optim/__init__.pyi +--- pytorch-v1.5.0/torch/optim/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,13 +0,0 @@ -from . import lr_scheduler as lr_scheduler -from .adadelta import Adadelta @@ -14148,18 +14225,18 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -from .rprop import Rprop -from .sgd import SGD as SGD -from .sparse_adam import SparseAdam -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/lbfgs.pyi CODE/pytorch/torch/optim/lbfgs.pyi ---- pytorch/torch/optim/lbfgs.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/lbfgs.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/lbfgs.pyi pytorch-develop/torch/optim/lbfgs.pyi +--- pytorch-v1.5.0/torch/optim/lbfgs.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/lbfgs.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple, Optional -from .optimizer import _params_t, Optimizer - -class LBFGS(Optimizer): - def __init__(self, params: _params_t, lr: float=..., max_iter: int=..., max_eval: Optional[int]=..., tolerance_grad: float=..., tolerance_change: float=..., history_size: int=..., line_search_fn: Optional[str]=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/lr_scheduler.pyi CODE/pytorch/torch/optim/lr_scheduler.pyi ---- pytorch/torch/optim/lr_scheduler.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/lr_scheduler.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/lr_scheduler.pyi pytorch-develop/torch/optim/lr_scheduler.pyi +--- pytorch-v1.5.0/torch/optim/lr_scheduler.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/lr_scheduler.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,39 +0,0 @@ -from typing import Iterable, Any, Optional, Callable, Union, List -from .optimizer import Optimizer @@ -14200,9 +14277,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= -class CosineAnnealingWarmRestarts(_LRScheduler): - def __init__(self, optimizer: Optimizer, T_0: int=..., T_mult: int=..., eta_min: int=..., last_epoch: int=...) -> None: ... - def step(self, epoch: Optional[int] = ...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/optimizer.pyi CODE/pytorch/torch/optim/optimizer.pyi ---- pytorch/torch/optim/optimizer.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/optimizer.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/optimizer.pyi pytorch-develop/torch/optim/optimizer.pyi +--- pytorch-v1.5.0/torch/optim/optimizer.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/optimizer.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,18 +0,0 @@ -from typing import Iterable, Union, Callable, Optional, List -from .. import Tensor @@ -14222,35 +14299,35 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def zero_grad(self) -> None: ... - def step(self, closure: Optional[Callable[[], float]]=...) -> Optional[float]: ... - def add_param_group(self, param_group: dict) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/rmsprop.pyi CODE/pytorch/torch/optim/rmsprop.pyi ---- pytorch/torch/optim/rmsprop.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/rmsprop.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/rmsprop.pyi pytorch-develop/torch/optim/rmsprop.pyi +--- pytorch-v1.5.0/torch/optim/rmsprop.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/rmsprop.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class RMSprop(Optimizer): - def __init__(self, params: _params_t, lr: float=..., alpha: float=..., eps: float=..., weight_decay: float=..., momentum: float=..., centered: bool=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/rprop.pyi CODE/pytorch/torch/optim/rprop.pyi ---- pytorch/torch/optim/rprop.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/rprop.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/rprop.pyi pytorch-develop/torch/optim/rprop.pyi +--- pytorch-v1.5.0/torch/optim/rprop.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/rprop.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,5 +0,0 @@ -from typing import Tuple -from .optimizer import _params_t, Optimizer - -class Rprop(Optimizer): - def __init__(self, params: _params_t, lr: float=..., etas: Tuple[float, float]=..., step_sizes: Tuple[float, float]=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/sgd.pyi CODE/pytorch/torch/optim/sgd.pyi ---- pytorch/torch/optim/sgd.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/sgd.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/sgd.pyi pytorch-develop/torch/optim/sgd.pyi +--- pytorch-v1.5.0/torch/optim/sgd.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/sgd.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,4 +0,0 @@ -from .optimizer import _params_t, Optimizer - -class SGD(Optimizer): - def __init__(self, params: _params_t, lr: float, momentum: float=..., dampening: float=..., weight_decay:float=..., nesterov:bool=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/optim/sparse_adam.pyi CODE/pytorch/torch/optim/sparse_adam.pyi ---- pytorch/torch/optim/sparse_adam.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/optim/sparse_adam.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/optim/sparse_adam.pyi pytorch-develop/torch/optim/sparse_adam.pyi +--- pytorch-v1.5.0/torch/optim/sparse_adam.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/optim/sparse_adam.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,6 +0,0 @@ - -from typing import Tuple @@ -14258,9 +14335,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - -class SparseAdam(Optimizer): - def __init__(self, params: _params_t, lr: float=..., betas: Tuple[float, float]=..., eps: float=...) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/serialization.py CODE/pytorch/torch/serialization.py ---- pytorch/torch/serialization.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/serialization.py 2021-06-17 11:41:09.425776649 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/serialization.py pytorch-develop/torch/serialization.py +--- pytorch-v1.5.0/torch/serialization.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/serialization.py 2021-06-25 16:37:36.962270093 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -14342,9 +14419,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= def location_tag(storage): -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/storage.py CODE/pytorch/torch/storage.py ---- pytorch/torch/storage.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/storage.py 2021-06-17 11:41:09.425776649 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/storage.py pytorch-develop/torch/storage.py +--- pytorch-v1.5.0/torch/storage.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/storage.py 2021-06-25 16:37:36.962270093 +0800 @@ -7,6 +7,7 @@ class _StorageBase(object): @@ -14362,9 +14439,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= elif get_sharing_strategy() == 'file_system': self._share_filename_() else: -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/tensor.py CODE/pytorch/torch/tensor.py ---- pytorch/torch/tensor.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/tensor.py 2021-06-17 11:41:09.425776649 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/tensor.py pytorch-develop/torch/tensor.py +--- pytorch-v1.5.0/torch/tensor.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/tensor.py 2021-06-25 16:37:36.962270093 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -14424,9 +14501,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= return self def __reversed__(self): -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/_tensor_str.py CODE/pytorch/torch/_tensor_str.py ---- pytorch/torch/_tensor_str.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/_tensor_str.py 2021-06-17 11:41:09.361776160 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/_tensor_str.py pytorch-develop/torch/_tensor_str.py +--- pytorch-v1.5.0/torch/_tensor_str.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/_tensor_str.py 2021-06-25 16:37:36.898269605 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -14478,9 +14555,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= suffixes.append('device=\'' + str(self.device) + '\'') has_default_dtype = self.dtype in (torch.get_default_dtype(), torch.int64, torch.bool) -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/dataloader.py CODE/pytorch/torch/utils/data/dataloader.py ---- pytorch/torch/utils/data/dataloader.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/dataloader.py 2021-06-17 11:41:09.429776679 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/dataloader.py pytorch-develop/torch/utils/data/dataloader.py +--- pytorch-v1.5.0/torch/utils/data/dataloader.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/dataloader.py 2021-06-25 16:37:36.966270124 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -14537,9 +14614,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= self._pin_memory_thread_done_event)) pin_memory_thread.daemon = True pin_memory_thread.start() -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/dataloader.pyi CODE/pytorch/torch/utils/data/dataloader.pyi ---- pytorch/torch/utils/data/dataloader.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/dataloader.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/dataloader.pyi pytorch-develop/torch/utils/data/dataloader.pyi +--- pytorch-v1.5.0/torch/utils/data/dataloader.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/dataloader.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,44 +0,0 @@ -from typing import Any, Callable, TypeVar, Generic, overload, Sequence, List, Optional -from . import Dataset, Sampler @@ -14585,9 +14662,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __len__(self) -> int: ... - def __iter__(self) -> _BaseDataLoaderIter: ... - def __next__(self) -> Any: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/dataset.pyi CODE/pytorch/torch/utils/data/dataset.pyi ---- pytorch/torch/utils/data/dataset.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/dataset.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/dataset.pyi pytorch-develop/torch/utils/data/dataset.pyi +--- pytorch-v1.5.0/torch/utils/data/dataset.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/dataset.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,32 +0,0 @@ -from typing import TypeVar, Generic, Iterable, Sequence, List, Tuple -from ... import Tensor @@ -14621,9 +14698,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __init__(self, dataset: Dataset[T_co], indices: Sequence[int]) -> None: ... - -def random_split(dataset: Dataset[T], lengths: Sequence[int]) -> List[Subset[T]]: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/distributed.pyi CODE/pytorch/torch/utils/data/distributed.pyi ---- pytorch/torch/utils/data/distributed.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/distributed.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/distributed.pyi pytorch-develop/torch/utils/data/distributed.pyi +--- pytorch-v1.5.0/torch/utils/data/distributed.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/distributed.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,9 +0,0 @@ -from typing import TypeVar, Optional, Iterator -from . import Sampler, Dataset @@ -14634,9 +14711,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __iter__(self) -> Iterator[int]: ... - def __len__(self) -> int: ... - def set_epoch(self, epoch: int) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/__init__.pyi CODE/pytorch/torch/utils/data/__init__.pyi ---- pytorch/torch/utils/data/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/__init__.pyi pytorch-develop/torch/utils/data/__init__.pyi +--- pytorch-v1.5.0/torch/utils/data/__init__.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/__init__.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,7 +0,0 @@ -from .sampler import Sampler as Sampler, SequentialSampler as SequentialSampler, RandomSampler as RandomSampler, \ - SubsetRandomSampler as SubsetRandomSampler, WeightedRandomSampler as WeightedRandomSampler, BatchSampler as BatchSampler @@ -14645,9 +14722,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - Subset as Subset, random_split as random_split, IterableDataset as IterableDataset, \ - ChainDataset as ChainDataset -from .dataloader import DataLoader as DataLoader, get_worker_info as get_worker_info -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/sampler.pyi CODE/pytorch/torch/utils/data/sampler.pyi ---- pytorch/torch/utils/data/sampler.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/sampler.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/sampler.pyi pytorch-develop/torch/utils/data/sampler.pyi +--- pytorch-v1.5.0/torch/utils/data/sampler.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/sampler.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,38 +0,0 @@ -from typing import Iterator, Optional, Sequence, List, TypeVar, Generic, Sized -from ... import Tensor @@ -14687,9 +14764,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - drop_last: bool - - def __init__(self, sampler: Sampler[int], batch_size: int, drop_last: bool) -> None: ... -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/data/_utils/pin_memory.py CODE/pytorch/torch/utils/data/_utils/pin_memory.py ---- pytorch/torch/utils/data/_utils/pin_memory.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/data/_utils/pin_memory.py 2021-06-17 11:41:09.429776679 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/data/_utils/pin_memory.py pytorch-develop/torch/utils/data/_utils/pin_memory.py +--- pytorch-v1.5.0/torch/utils/data/_utils/pin_memory.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/data/_utils/pin_memory.py 2021-06-25 16:37:36.966270124 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. @@ -14733,9 +14810,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # See NOTE [ Data Loader Multiprocessing Shutdown Logic ] for details on the # logic of this function. -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/hooks.pyi CODE/pytorch/torch/utils/hooks.pyi ---- pytorch/torch/utils/hooks.pyi 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/hooks.pyi 1970-01-01 08:00:00.000000000 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/hooks.pyi pytorch-develop/torch/utils/hooks.pyi +--- pytorch-v1.5.0/torch/utils/hooks.pyi 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/hooks.pyi 1970-01-01 08:00:00.000000000 +0800 @@ -1,11 +0,0 @@ -from typing import Any - @@ -14748,9 +14825,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= - def __enter__(self): ... - def __exit__(self, type: Any, value: Any, tb: Any) -> None: ... - -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/utils/__init__.py CODE/pytorch/torch/utils/__init__.py ---- pytorch/torch/utils/__init__.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/utils/__init__.py 2021-06-17 11:41:09.425776649 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/utils/__init__.py pytorch-develop/torch/utils/__init__.py +--- pytorch-v1.5.0/torch/utils/__init__.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/utils/__init__.py 2021-06-25 16:37:36.966270124 +0800 @@ -1,6 +1,7 @@ from __future__ import absolute_import, division, print_function, unicode_literals @@ -14759,9 +14836,9 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude= # Set the module for a given object for nicer printing def set_module(obj, mod): -diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur pytorch/torch/_utils.py CODE/pytorch/torch/_utils.py ---- pytorch/torch/_utils.py 2021-04-10 18:39:32.000000000 +0800 -+++ CODE/pytorch/torch/_utils.py 2021-06-17 11:41:09.361776160 +0800 +diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' -Nur '--exclude=README*' pytorch-v1.5.0/torch/_utils.py pytorch-develop/torch/_utils.py +--- pytorch-v1.5.0/torch/_utils.py 2021-04-10 18:39:32.000000000 +0800 ++++ pytorch-develop/torch/_utils.py 2021-06-25 16:37:36.898269605 +0800 @@ -1,3 +1,19 @@ +# Copyright (c) 2020 Huawei Technologies Co., Ltd +# Copyright (c) 2019, Facebook CORPORATION. diff --git a/src/aten/src/ATen/native/npu/AddKernelNpu.cpp b/src/aten/src/ATen/native/npu/AddKernelNpu.cpp index b0aafa79fbba9a505d44422db76b57814715ada7..a2c4c8301ddc9087871c8f6a9538a9553ce14fe5 100644 --- a/src/aten/src/ATen/native/npu/AddKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/AddKernelNpu.cpp @@ -76,10 +76,18 @@ Tensor& add_out_npu_nocheck( TORCH_WARN_ONCE("The oprator of add is executed, Currently High Accuracy but Low Performance OP with 64-bit has been used," "Please Do Some Cast at Python Functions with 32-bit for Better Performance!"); } + + std::string real_type = ""; + if (self.scalar_type() == c10::ScalarType::Bool && other.scalar_type() == c10::ScalarType::Bool) { + unified_result.common_type = c10::ScalarType::Byte; + unified_result.result_type_defined = true; + cmd.Expect(unified_result); + real_type = "uint8"; + } cmd.Name("Add") .Input(self) .Input(other) - .Output(result) + .Output(result, real_type) .Run(); } else { if (c10::npu::OptionsManager::CheckDynamicOptimizer("ADD")) { diff --git a/src/aten/src/ATen/native/npu/MatmulKernelNpu.cpp b/src/aten/src/ATen/native/npu/MatmulKernelNpu.cpp index f75f0afd19652a18110a426717079d6a3a9dd496..f490d5ded51574fd3236c73add1048add81afbc9 100644 --- a/src/aten/src/ATen/native/npu/MatmulKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/MatmulKernelNpu.cpp @@ -15,6 +15,7 @@ // limitations under the License. #include #include "c10/npu/OptionsManager.h" +#include "ATen/native/npu/interface/EnvVariables.h" #include "ATen/native/npu/common/InnerNpuNativeFunction.h" namespace at { namespace native { @@ -27,7 +28,7 @@ Tensor matmul_npu( Tensor out = out_opt.value_or(Tensor()); if (tensor1.is_npu() && tensor2.is_npu() && tensor1.scalar_type() == kHalf && tensor2.scalar_type() == kHalf && - c10::npu::OptionsManager::CheckBmmV2Enable()) { + npu::env::CheckBmmV2Enable()) { auto res = matmul_by_bmmV2(tensor1, tensor2); return has_out ? out.set_(res) : res; } diff --git a/src/aten/src/ATen/native/npu/MedianKernelNpu.cpp b/src/aten/src/ATen/native/npu/MedianKernelNpu.cpp index ab67d86e7a16f1396a1fc9072857af014060956f..7f77c92962d8b03407f2c17053060a2d885c7d08 100644 --- a/src/aten/src/ATen/native/npu/MedianKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/MedianKernelNpu.cpp @@ -109,7 +109,7 @@ std::tuple median_out_npu( OpPreparation::CheckOut( {self}, indices, - ACL_FORMAT_NCHW, + ACL_FORMAT_ND, ScalarType::Int, outputSize); diff --git a/src/aten/src/ATen/native/npu/convolution/Conv2dBackwardKernelNpu.cpp b/src/aten/src/ATen/native/npu/convolution/Conv2dBackwardKernelNpu.cpp index 60b494e9b3529f08de7ec4c327807fc37f6edcd5..aef6aecfef05b0efd13fccabdd9a3bae2c216fda 100644 --- a/src/aten/src/ATen/native/npu/convolution/Conv2dBackwardKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/convolution/Conv2dBackwardKernelNpu.cpp @@ -248,10 +248,19 @@ tuple conv2d_backward_npu( } if (grad_input_mask[1]) { - gradWeight = at::empty_with_format( - std::get<1>(outputSizes), - weight.options().dtype(kFloat), - ACL_FORMAT_FRACTAL_Z); + // For group conv2d: keep consistent with weight to avoid allreduce accuracy problem. + // For more info: https://gitee.com/ascend/pytorch-develop/pulls/2255 + if (groups > 1) { + gradWeight = at::empty_with_format( + std::get<1>(outputSizes), + weight.options().dtype(kFloat), + ACL_FORMAT_NCHW); + } else { + gradWeight = at::empty_with_format( + std::get<1>(outputSizes), + weight.options().dtype(kFloat), + ACL_FORMAT_FRACTAL_Z); + } } if (grad_input_mask[2]) { diff --git a/src/aten/src/ATen/native/npu/interface/EnvVariables.cpp b/src/aten/src/ATen/native/npu/interface/EnvVariables.cpp index 8d585790de51dc9ba7cfeed00e2d7ee8e9821b55..8332005e50a493869c99778703935bb8b25b818f 100644 --- a/src/aten/src/ATen/native/npu/interface/EnvVariables.cpp +++ b/src/aten/src/ATen/native/npu/interface/EnvVariables.cpp @@ -1,6 +1,8 @@ #include "c10/npu/register/OptionRegister.h" +#include "c10/util/Exception.h" +#include namespace at { namespace native { @@ -10,12 +12,21 @@ namespace env { REGISTER_OPTION(autotune) REGISTER_OPTION_BOOL_FUNCTION(AutoTuneEnabled, autotune, "disable", "enable") +REGISTER_OPTION_INIT_BY_ENV(bmmv2_enable) +REGISTER_OPTION_BOOL_FUNCTION(CheckBmmV2Enable, bmmv2_enable, "0", "1") + REGISTER_OPTION(ACL_OP_DEBUG_LEVEL) REGISTER_OPTION(ACL_DEBUG_DIR) REGISTER_OPTION(ACL_OP_COMPILER_CACHE_MODE) REGISTER_OPTION(ACL_OP_COMPILER_CACHE_DIR) REGISTER_OPTION(NPU_FUZZY_COMPILE_BLACKLIST) +REGISTER_OPTION_HOOK(mdldumpswitch, [](const std::string& val) { + if (val == "init") { aclmdlInitDump(); } + else if (val == "finalize") { aclmdlFinalizeDump(); } + else { TORCH_CHECK(0, "set initdump value only support init or finalize, but got ", val); } + }) +REGISTER_OPTION_HOOK(mdldumpconfigpath, [](const std::string& val) { aclmdlSetDump(val.c_str()); }) } // namespace env } // namespace npu } // namespace native diff --git a/src/aten/src/ATen/native/npu/interface/EnvVariables.h b/src/aten/src/ATen/native/npu/interface/EnvVariables.h index 16b776855678c7f26407f7c4f71bc5fdfa3b22ba..d17617d41601bdd6a6229341a1af96c79193134f 100644 --- a/src/aten/src/ATen/native/npu/interface/EnvVariables.h +++ b/src/aten/src/ATen/native/npu/interface/EnvVariables.h @@ -25,6 +25,7 @@ namespace env { check if the autotuen is enabled, return true or false. */ bool AutoTuneEnabled(); +bool CheckBmmV2Enable(); } // namespace env } // namespace npu diff --git a/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesBackwardKernelNpu.cpp b/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesBackwardKernelNpu.cpp index 3619164c167ea02c59b324bf05096dd9cc6dbf54..a61ae398d3e6f9c875149bddc2591fe63174c910 100644 --- a/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesBackwardKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesBackwardKernelNpu.cpp @@ -15,6 +15,7 @@ // limitations under the License. #include "ATen/native/npu/utils/OpAdapter.h" +#include namespace at { namespace native { @@ -61,7 +62,7 @@ Tensor& max_pool2d_with_indices_backward_out_npu( } Tensor max_pool2d_with_indices_backward_npu( - const Tensor& grad_output, + const Tensor& grad_output_, const Tensor& self, IntArrayRef kernel_size, IntArrayRef stride, @@ -69,6 +70,51 @@ Tensor max_pool2d_with_indices_backward_npu( IntArrayRef dilation, bool ceil_mode, const Tensor& indices) { + TORCH_CHECK(kernel_size.size() == 1 || kernel_size.size() == 2, + "max_pool2d: kernel_size must either be a single int, or a tuple of two ints") + const int kH = safe_downcast(kernel_size[0]); + const int kW = kernel_size.size() == 1 ? kH : safe_downcast(kernel_size[1]); + SmallVector kernel_sizes = {kH, kW}; + IntArrayRef kernel_sizess = IntArrayRef(kernel_sizes); + + // NB: stride default is not expressible as an integer constant, so we accept + // empty stride for this case + TORCH_CHECK(stride.size() == 0 || stride.size() == 1 || stride.size() == 2, + "max_pool2d: stride must either be omitted, a single int, or a tuple of two ints") + const int dH = stride.empty() ? kH : safe_downcast(stride[0]); + const int dW = stride.empty() ? kW : + stride.size() == 1 ? dH : safe_downcast(stride[1]); + SmallVector strides = {dH, dW}; + IntArrayRef stridess = IntArrayRef(strides); + + TORCH_CHECK(padding.size() == 1 || padding.size() == 2, + "max_pool2d: padding must be either be a single int, or a tuple of two ints"); + const int padH = safe_downcast(padding[0]); + const int padW = padding.size() == 1 ? padH : safe_downcast(padding[1]); + SmallVector paddings = {padH, padW}; + IntArrayRef padss = IntArrayRef(paddings); + + TORCH_CHECK(dilation.size() == 1 || dilation.size() == 2, + "max_pool2d: dilation must be either a single int, or a tuple of two ints"); + const int dilationH = safe_downcast(dilation[0]); + const int dilationW = dilation.size() == 1 ? dilationH : safe_downcast(dilation[1]); + SmallVector dilations = {dilationH, dilationW}; + IntArrayRef dilationss = IntArrayRef(dilations); + + TORCH_CHECK((self.ndimension() == 3 || self.ndimension() == 4), + "non-empty 3D or 4D (batch mode) tensor expected for input"); + + /* get contiguous gradOutput */ + const Tensor grad_output = grad_output_.contiguous(); + + /* sizes */ + const int64_t inputHeight = self.size(-2); + const int64_t inputWidth = self.size(-1); + + /* XXX preserve the existing shape check behavior */ + const int64_t outputHeight_for_shape_check = pooling_output_shape(inputHeight, kH, padH, dH, dilationH, ceil_mode); + const int64_t outputWidth_for_shape_check = pooling_output_shape(inputWidth, kW, padW, dW, dilationW, ceil_mode); + // construct the output tensor of the NPU Tensor grad_input = OpPreparation::ApplyTensor(self); @@ -77,10 +123,10 @@ Tensor max_pool2d_with_indices_backward_npu( grad_input, grad_output, self, - kernel_size, - stride, - padding, - dilation, + kernel_sizess, + stridess, + padss, + dilationss, ceil_mode, indices); diff --git a/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesKernelNpu.cpp b/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesKernelNpu.cpp index d306e046a6864cec1495c403015b0a67ec079472..82702d7494160cd98c79676210d20063afb8867a 100644 --- a/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesKernelNpu.cpp +++ b/src/aten/src/ATen/native/npu/pooling/MaxPool2dWithIndicesKernelNpu.cpp @@ -15,6 +15,7 @@ // limitations under the License. #include "ATen/native/npu/utils/OpAdapter.h" +#include namespace at { namespace native { @@ -65,32 +66,62 @@ tuple max_pool2d_with_indices_npu( IntArrayRef padding, IntArrayRef dilation, bool ceil_mode) { - // calculate the output size - int64_t strideH = 1; - int64_t strideW = 1; - if (stride.empty()) { - strideH = kernel_size[0]; - strideW = kernel_size[1]; - } else { - strideH = stride[0]; - strideW = stride[1]; - } + TORCH_CHECK(kernel_size.size() == 1 || kernel_size.size() == 2, + "max_pool2d: kernel_size must either be a single int, or a tuple of two ints") + const int kH = safe_downcast(kernel_size[0]); + const int kW = kernel_size.size() == 1 ? kH : safe_downcast(kernel_size[1]); + SmallVector kernel_sizes = {kH, kW}; + IntArrayRef kernel_sizess = IntArrayRef(kernel_sizes); + + // NB: stride default is not expressible as an integer constant, so we accept + // empty stride for this case + TORCH_CHECK(stride.size() == 0 || stride.size() == 1 || stride.size() == 2, + "max_pool2d: stride must either be omitted, a single int, or a tuple of two ints") + const int dH = stride.empty() ? kH : safe_downcast(stride[0]); + const int dW = stride.empty() ? kW : + stride.size() == 1 ? dH : safe_downcast(stride[1]); + SmallVector strides = {dH, dW}; + IntArrayRef stridess = IntArrayRef(strides); + + TORCH_CHECK(padding.size() == 1 || padding.size() == 2, + "max_pool2d: padding must be either be a single int, or a tuple of two ints"); + const int padH = safe_downcast(padding[0]); + const int padW = padding.size() == 1 ? padH : safe_downcast(padding[1]); + SmallVector paddings = {padH, padW}; + IntArrayRef padss = IntArrayRef(paddings); + + TORCH_CHECK(dilation.size() == 1 || dilation.size() == 2, + "max_pool2d: dilation must be either a single int, or a tuple of two ints"); + const int dilationH = safe_downcast(dilation[0]); + const int dilationW = dilation.size() == 1 ? dilationH : safe_downcast(dilation[1]); + SmallVector dilations = {dilationH, dilationW}; + IntArrayRef dilationss = IntArrayRef(dilations); + + TORCH_CHECK((self.ndimension() == 3 || self.ndimension() == 4), + "non-empty 3D or 4D (batch mode) tensor expected for input"); + + /* sizes */ + const int64_t nbatch = self.ndimension() == 4 ? self.size(-4) : 1; + const int64_t nInputPlane = self.size(-3); + const int64_t inputHeight = self.size(-2); + const int64_t inputWidth = self.size(-1); + + const int64_t outputHeight = pooling_output_shape(inputHeight, kH, padH, dH, dilationH, ceil_mode); + const int64_t outputWidth = pooling_output_shape(inputWidth, kW, padW, dW, dilationW, ceil_mode); - int64_t N = self.size(0); - int64_t C = self.size(1); - int64_t H = self.size(2); - int64_t W = self.size(3); + pool2d_shape_check( + self, + kH, kW, dH, dW, padH, padW, dilationH, dilationW, + nInputPlane, + inputHeight, inputWidth, + outputHeight, outputWidth); - int64_t Ho = (H + 2 * padding[0] - dilation[0] * (kernel_size[0] - 1) - 1 + - (ceil_mode ? strideH - 1 : 0)) / strideH + 1; - int64_t Wo = (W + 2 * padding[1] - dilation[1] * (kernel_size[1] - 1) - 1 + - (ceil_mode ? strideW - 1 : 0)) / strideW + 1; - SmallVector outputSize = {N, C, Ho, Wo}; + SmallVector outputSize = {nbatch, nInputPlane, outputHeight, outputWidth}; const int64_t BLOCKSIZE = 16; int64_t maskH = kernel_size[0] * kernel_size[1]; - int64_t maskW = (CeilDiv(Ho * Wo, BLOCKSIZE) + 1); - SmallVector indicesSize = {N, C, maskH, maskW}; + int64_t maskW = (CeilDiv(outputHeight * outputWidth, BLOCKSIZE) + 1); + SmallVector indicesSize = {nbatch, nInputPlane, maskH, maskW}; // construct the output tensor of the NPU Tensor output = OpPreparation::ApplyTensorWithFormat(self, outputSize, ACL_FORMAT_NC1HWC0); @@ -98,7 +129,7 @@ tuple max_pool2d_with_indices_npu( // calculate the output result of the NPU max_pool2d_with_indices_out_npu( - output, indices, self, kernel_size, stride, padding, dilation, ceil_mode); + output, indices, self, kernel_sizess, stridess, padss, dilationss, ceil_mode); return tuple(output, indices); } diff --git a/src/aten/src/ATen/native/npu/utils/CalcuOpUtil.cpp b/src/aten/src/ATen/native/npu/utils/CalcuOpUtil.cpp index 81d29426b53840b9805754e1788019d2edad03ae..33abf12e71ace29e2c19d3b5ac99df1b8002d19d 100644 --- a/src/aten/src/ATen/native/npu/utils/CalcuOpUtil.cpp +++ b/src/aten/src/ATen/native/npu/utils/CalcuOpUtil.cpp @@ -63,6 +63,7 @@ static std::map AT_SCALAR_TYPE_NAME_MAP = { static std::map STRING_SCALAR_TYPE_TO_ACL_TYPE_MAP = { {"uint16", ACL_UINT16}, + {"uint8", ACL_UINT8} }; string GetAtScalarTypeName(const ScalarType data_type) { diff --git a/src/aten/src/ATen/utils/DumpUtils.cpp b/src/aten/src/ATen/utils/DumpUtils.cpp index 438a74602d1a4d334805795cc1b0e302ea277137..198affc63d8cb5d6891008b16c675a000e951788 100644 --- a/src/aten/src/ATen/utils/DumpUtils.cpp +++ b/src/aten/src/ATen/utils/DumpUtils.cpp @@ -89,6 +89,7 @@ namespace at { const H5std_string ATTR_FORMAT_NAME("FormatType"); const H5std_string ATTR_TYPE_NAME("Type"); const H5std_string ATTR_STRIDE_NAME("Stride"); + const H5std_string ATTR_REQUIRES_GRAD_NAME("RequiresGrad"); DumpUtil::DumpUtil() { } @@ -276,7 +277,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - int i = 0; for (auto& tensor : input.GetValue()) { string h5Path = GetValHdf5Path(irName, seqId, true, input.Name(), i); @@ -286,7 +286,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); WriteValToHdf5Dataset( h5Path, @@ -299,7 +298,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); WriteValToHdf5Dataset( h5Path, @@ -312,7 +310,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); int8_t data = input.GetValue(); WriteValToHdf5Dataset( @@ -326,7 +323,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); double data = input.GetValue(); WriteValToHdf5Dataset( @@ -340,7 +336,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - if (!input.GetValue()) { return; } @@ -357,7 +352,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); void* dataAddr = nullptr; @@ -389,7 +383,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - if (!input.GetValue()) { return; } @@ -406,7 +399,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - if (!input.GetValue()) { return; } @@ -442,7 +434,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); WriteValToHdf5Dataset( h5Path, @@ -455,7 +446,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); int data = ScalarTypeToDumpType(input.GetValue()); WriteValToHdf5Dataset( @@ -469,7 +459,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); int64_t data[2]; data[0]= input.GetValue().first; @@ -485,7 +474,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - int i = 0; for (auto& tensor : input.GetValue()) { string h5Path = GetValHdf5Path(irName, seqId, true, input.Name(), i); @@ -495,7 +483,6 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); WriteValToHdf5Dataset( h5Path, @@ -508,27 +495,52 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { + string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); + // create dataset + DataSpace dataspace = DataSpace(); + DataSet* dataset = nullptr; + dataset = new DataSet(file->createDataSet(h5Path, PredType::IEEE_F32LE, dataspace)); + // prepare device type attribute + int deviceType = static_cast(input.GetValue().device().type()); + PrepareSimpleHdf5Attr(dataset, ATTR_DEVICE_TYPE_NAME, PredType::STD_I32LE, &deviceType); + + // prepare dtype attribute + int dumpType = ScalarTypeToDumpType(at::typeMetaToScalarType(input.GetValue().dtype())); + if (dumpType == -1) { + // the dtype can not be recognized + delete dataset; + return; + } + PrepareSimpleHdf5Attr(dataset, ATTR_DATA_TYPE_NAME, PredType::STD_I32LE, &dumpType); + + // preare requires grad attribute + int32_t requiresGrad = static_cast(input.GetValue().requires_grad()); + PrepareSimpleHdf5Attr(dataset, ATTR_REQUIRES_GRAD_NAME, PredType::STD_I32LE, &requiresGrad); + + // ommit layout ,for only support kStrided, but not kSparse + + // prepare type attribute + int typeData = static_cast(SaveType::TENSOR_OPTS); + PrepareSimpleHdf5Attr(dataset, ATTR_TYPE_NAME, PredType::STD_I32LE, &typeData); + + delete dataset; + return; } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - // check the optional value if (!input.GetValue()) { return; @@ -546,11 +558,23 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - + // check the optional value + if (!input.GetValue()) { + return; + } + string h5Path = GetValHdf5Path(irName, seqId, true, input.Name()); + int data = ScalarTypeToDumpType(input.GetValue().value()); + WriteValToHdf5Dataset( + h5Path, + 0, + 1, + SaveType::ScalarType, + &data, + PredType::STD_I32LE, + PredType::STD_I32LE); } void DumpUtil::DumpOneInput(const string& irName, int seqId, @@ -558,35 +582,27 @@ namespace at { } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes>& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneInput(const string& irName, int seqId, const ArgDes& input) { - } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes>& output) { - int i = 0; for (auto& tensor : output.GetValue()) { string h5Path = GetValHdf5Path(irName, seqId, false, output.Name(), i); @@ -596,17 +612,14 @@ namespace at { } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - string h5Path = GetValHdf5Path(irName, seqId, false, output.Name()); DumpUtil::GetInstance()->DumpTensor(h5Path, output.GetValue()); } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - string h5Path = GetValHdf5Path(irName, seqId, false, output.Name()); WriteValToHdf5Dataset( h5Path, @@ -619,7 +632,6 @@ namespace at { } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { @@ -651,10 +663,8 @@ namespace at { } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - } void DumpUtil::DumpOneOutput(const string& irName, int seqId, const ArgDes& output) { - } } diff --git a/src/aten/src/ATen/utils/DumpUtils.h b/src/aten/src/ATen/utils/DumpUtils.h index ba9ec664efefaa6fea2036cccd6c7b6538d4d5f3..630e9a94f2e258472198f45c3e8e7ec3b1cc5bb5 100644 --- a/src/aten/src/ATen/utils/DumpUtils.h +++ b/src/aten/src/ATen/utils/DumpUtils.h @@ -17,6 +17,7 @@ #include "H5Cpp.h" #include "torch/csrc/autograd/VariableTypeUtils.h" #include +#include using std::string; using std::vector; @@ -51,15 +52,25 @@ enum class SaveType:int32_t { PAIR = 15, AR_LONG_INT = 16, OPT_MEM_FMT = 17, + TENSOR_OPTS = 18, }; template struct ArgDes { public: explicit ArgDes(string name, const T& value): name_(move(name)), value_(value) {} - const string& Name() const {return name_;} - const T& GetValue() const {return value_;} - void SetValue(const T &value) {value_ = value;} + + const string& Name() const { + return name_; + } + + const T& GetValue() const { + return value_; + } + + void SetValue(const T &value) { + value_ = value; + } private: string name_; T value_; @@ -180,21 +191,38 @@ class DumpUtil { return dumpSeqId; } - bool CanDumpNow() { - return !isDumping && isDumpSwitchOn; + bool IsDumping() { + return isDumping; + } + + bool IsDumpSwitchOn() { + return isDumpSwitchOn; } void SetDumpFlag(bool flag) { isDumping = flag; return; } + void SetDumpSwitch(bool flag) { isDumpSwitchOn = flag; return; } - void SetDumpFilePath(const string& filePath) {dumpFilePath = filePath;}; + void SetDumpFilePath(const string& filePath) { + dumpFilePath = filePath; + } + void DumpLazyInit(); + + void Lock() { + mu_.lock(); + } + + void Unlock() { + mu_.unlock(); + } + private: DumpUtil(); H5::H5File* file = nullptr; @@ -203,6 +231,7 @@ class DumpUtil { bool isDumpSwitchOn = false; string dumpFilePath = "dump.h5"; bool dumpInit = false; + std::recursive_mutex mu_; }; } // namespace c10 diff --git a/src/aten/src/ATen/utils/LoadUtils.cpp b/src/aten/src/ATen/utils/LoadUtils.cpp index 652b7fbde7171995bb393ab9ee3d28556f728663..10ed418f73741cbe46f7c78e5193da07fd1013a1 100644 --- a/src/aten/src/ATen/utils/LoadUtils.cpp +++ b/src/aten/src/ATen/utils/LoadUtils.cpp @@ -32,6 +32,7 @@ namespace at { void SetLoadPath(string path) { LoadUtil::GetInstance()->SetLoadFilePath(path); + LoadUtil::GetInstance()->LoadLazyInit(); return; } @@ -102,7 +103,11 @@ namespace at { } } - void MaybeMapName(CommDesc& commDesc) { + void MaybeMapName(CommDesc& commDesc, const H5File* file) { + std::string h5IRPath = "/" + commDesc.nameIr; + if (file->nameExists(h5IRPath)) { + return ; + } if (IrNameMapper.find(commDesc.nameIr) != IrNameMapper.end()) { auto oriNameIr = commDesc.nameIr; commDesc.nameIr = IrNameMapper[commDesc.nameIr]; @@ -337,7 +342,11 @@ namespace at { //1.dtype Attribute attr = dataset.openAttribute(ATTR_DATA_TYPE_NAME); attr.read(attr.getDataType(), &dtypeValue); - if (dtypeValue != ScalarTypeToDumpType((*it).tensor.scalar_type())) { + // some ops on npu only support int32 while those ops support long on GPU + // need more tests to verify these cases + if (dtypeValue == ScalarTypeToDumpType(c10::kLong) && (*it).tensor.scalar_type() == c10::kInt) { + ; + } else if (dtypeValue != ScalarTypeToDumpType((*it).tensor.scalar_type())) { is_matched = false; break; } @@ -345,7 +354,6 @@ namespace at { //2.stride attr = dataset.openAttribute("Stride"); int h5StrideSize = static_cast(attr.getSpace().getSimpleExtentNpoints()); - if (h5StrideSize == (*it).tensor.strides().size()) { int64_t* stride = new int64_t[h5StrideSize]; attr.read(attr.getDataType(), stride); @@ -639,7 +647,6 @@ namespace at { return -1; } - Group curGroup = file->openGroup(h5IRPath); int numCurGroup = curGroup.getNumObjs(); int i = 0; @@ -651,7 +658,6 @@ namespace at { i++; continue; } - is_matched = true; if (!ExhaustedMatchingTorchType(seqH5, file, nameIr, commDesc)) { @@ -683,6 +689,20 @@ namespace at { } + // when the stride of some dim is zero, the tensor may has been "expand", copy should only + // process on any axis of that dim + // To do: is this kind of copy matches other zero stride cases? + void CopyMaybeWithZeroStride(Tensor dst, Tensor src) { + auto strides = dst.strides().vec(); + for (int i = 0; i < strides.size(); i++) { + if (strides[i] == 0) { + dst = dst.select(i, 0); + src = src.select(i, 0); + } + } + dst.copy_(src); + } + void TensorCopying(const int & seqH5, const string nameIr, const H5File* file, CommDesc& commDesc) { std::string h5DataSetPath; for (auto it = commDesc.tensorDescVec.begin(); it != commDesc.tensorDescVec.end(); it++) { @@ -708,16 +728,16 @@ namespace at { Attribute attr = dataset.openAttribute(ATTR_DEVICE_TYPE_NAME); attr.read(attr.getDataType(), &deviceTypeValue); - Tensor tharray; + Tensor thArray; if ((*it).tensor.scalar_type() != ScalarType::Half) { auto options = at::TensorOptions().dtype((*it).tensor.scalar_type()); if (deviceTypeValue[0] == 10) { - tharray = at::from_blob(data, (*it).tensor.sizes(), options); + thArray = at::from_blob(data, (*it).tensor.sizes(), options); } else { - tharray = at::from_blob(data, (*it).tensor.sizes(), (*it).tensor.strides(), options); + thArray = at::from_blob(data, (*it).tensor.sizes(), (*it).tensor.strides(), options); } auto verCountBefore = (*it).tensor.unsafeGetTensorImpl()->version_counter().current_version(); - (*it).tensor.detach().copy_(tharray); + CopyMaybeWithZeroStride((*it).tensor.detach(), thArray.to((*it).tensor.device()).to((*it).tensor.dtype())); auto verCountAfter = (*it).tensor.unsafeGetTensorImpl()->version_counter().current_version(); if (verCountAfter > verCountBefore) { (*it).tensor.unsafeGetTensorImpl()->reduce_version(); @@ -725,12 +745,12 @@ namespace at { } else { auto options = at::TensorOptions().dtype(at::kFloat); if (deviceTypeValue[0] == 10) { - tharray = at::from_blob(data, (*it).tensor.sizes(), options); + thArray = at::from_blob(data, (*it).tensor.sizes(), options); } else { - tharray = at::from_blob(data, (*it).tensor.sizes(), (*it).tensor.strides(), options); + thArray = at::from_blob(data, (*it).tensor.sizes(), (*it).tensor.strides(), options); } auto verCountBefore = (*it).tensor.unsafeGetTensorImpl()->version_counter().current_version(); - (*it).tensor.detach().copy_(tharray.to(at::kHalf).to((*it).tensor.device())); + CopyMaybeWithZeroStride((*it).tensor.detach(), thArray.to(at::kHalf).to((*it).tensor.device())); auto verCountAfter = (*it).tensor.unsafeGetTensorImpl()->version_counter().current_version(); if (verCountAfter > verCountBefore) { (*it).tensor.unsafeGetTensorImpl()->reduce_version(); @@ -799,12 +819,10 @@ namespace at { } void LoadUtil::Process() { - MaybeMapName(commDesc); + MaybeMapName(commDesc, file); int seqH5 = ProcessMatching(file, commDesc.nameIr, commDesc, visitedSeq); if (seqH5 > -1) { - ProcessCopying(seqH5, commDesc.nameIr, file, commDesc); - } commDesc.tensorDescVec.clear(); commDesc.int64DescVec.clear(); diff --git a/src/aten/src/ATen/utils/LoadUtils.h b/src/aten/src/ATen/utils/LoadUtils.h index 7f4051016c86005088570eaa683478e2b91f0c7b..b779976a9e89c4df33958704c03c951ffa7d19e1 100644 --- a/src/aten/src/ATen/utils/LoadUtils.h +++ b/src/aten/src/ATen/utils/LoadUtils.h @@ -49,96 +49,115 @@ struct CommDesc { }; class LoadUtil { - public: - ~LoadUtil(); - - static LoadUtil* GetInstance() { - static LoadUtil instance; - return &instance; - }; - - bool LoadTensor(const at::Tensor &t, string nameIr, bool isList, string nameTensor, bool isLast); - - void Process(); - - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes>> &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); - void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); - - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes>> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - void LoadOneInput(const string &irName, ArgDes &input, bool isLast); - - template - void LoadInputs(std::string &irName, T &t) { - if (loadInit) { - LoadOneInput(irName, t, true); - } - return; + public: + ~LoadUtil(); + + static LoadUtil* GetInstance() { + static LoadUtil instance; + return &instance; + }; + + bool LoadTensor(const at::Tensor &t, string nameIr, bool isList, string nameTensor, bool isLast); + + void Process(); + + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes>> &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes &t, bool isLast); + void LoadOneInput(std::string &irName, ArgDes> &t, bool isLast); + + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes>> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes> &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + void LoadOneInput(const string &irName, ArgDes &input, bool isLast); + + template + void LoadInputs(std::string &irName, T &t) { + if (loadInit) { + LoadOneInput(irName, t, true); } - - template - void LoadInputs(std::string &irName, T &t, Args &... rest) { - if (loadInit) { - LoadOneInput(irName, t, false); - LoadInputs(irName, rest...); - } - return; + return; + } + + template + void LoadInputs(std::string &irName, T &t, Args &... rest) { + if (loadInit) { + LoadOneInput(irName, t, false); + LoadInputs(irName, rest...); } + return; + } - void SetLoadFlag(bool flag) { - if (flag) { - LoadLazyInit(); - } - isInIr = flag; - } + void SetLoadFlag(bool flag) { + isInIr = flag; + } - bool CanLoadNow() {return !isInIr && isLoadSwitchOn;}; - void SetLoadFilePath(const string& filePath) {loadFilePath = filePath;}; - int GetMatchedSeqId() {return matchedSeqId;}; + bool IsLoading() { + return isInIr; + } - void SetLoadSwitch(bool flag) { - isLoadSwitchOn = flag; - return; - } + bool IsLoadSwitchOn() { + return isLoadSwitchOn; + } + + void SetLoadFilePath(const string& filePath) { + loadFilePath = filePath; + } + + int GetMatchedSeqId() { + return matchedSeqId; + } + + void SetLoadSwitch(bool flag) { + isLoadSwitchOn = flag; + return; + } void LoadLazyInit(); - private: - LoadUtil(); - H5::H5File* file = nullptr; - CommDesc commDesc; - std::vector visitedSeq; - bool isInIr = false; - string loadFilePath = "Jason_1.h5"; - int matchedSeqId = -1; - bool isLoadSwitchOn = false; - bool loadInit = false; + + void Lock() { + mu_.lock(); + } + + void Unlock() { + mu_.unlock(); + } + + private: + LoadUtil(); + H5::H5File* file = nullptr; + CommDesc commDesc; + std::vector visitedSeq; + bool isInIr = false; + string loadFilePath = "Jason_1.h5"; + int matchedSeqId = -1; + bool isLoadSwitchOn = false; + bool loadInit = false; + std::recursive_mutex mu_; }; } // namespace c10 diff --git a/src/c10/npu/OptionsManager.cpp b/src/c10/npu/OptionsManager.cpp index cbb1d15a13269e4aaaf379f540ac70b4089d42b9..d65ab761f713acf7201bdf8c7c63dc466812f180 100644 --- a/src/c10/npu/OptionsManager.cpp +++ b/src/c10/npu/OptionsManager.cpp @@ -72,14 +72,6 @@ bool OptionsManager::CheckSwitchMMOutputEnable() { return (switchMMOutputEnable == 1); } -bool OptionsManager::CheckBmmV2Enable() { - static int bmmV2Enable = -1; - if (bmmV2Enable == -1) { - bmmV2Enable = GetBoolTypeOption("BMMV2_ENABLE"); - } - return (bmmV2Enable == 1); -} - int OptionsManager::GetBoolTypeOption(const char* env_str) { char* env_val = std::getenv(env_str); int64_t envFlag = (env_val != nullptr) ? strtol(env_val, nullptr, 10) : 0; diff --git a/src/c10/npu/OptionsManager.h b/src/c10/npu/OptionsManager.h index 217b93f20ff3e819a54a89ad1f0a5ac3f4b76b40..62e3e156290361d9415d4aed10a845125db7fdf4 100644 --- a/src/c10/npu/OptionsManager.h +++ b/src/c10/npu/OptionsManager.h @@ -33,7 +33,6 @@ class OptionsManager { static bool CheckDynamicEnable(); static bool CheckAclDumpDateEnable(); static bool CheckSwitchMMOutputEnable(); - static bool CheckBmmV2Enable(); static bool CheckDynamicLogEnable(); static bool CheckDynamicOptimizer(const char* op); static bool CheckUseNpuLogEnable(); diff --git a/src/c10/npu/interface/AclInterface.cpp b/src/c10/npu/interface/AclInterface.cpp index 4e64edb7d1cb9d1945430f6f8d901e3140b929d6..3121ae3f625a0a0e605392991da8d0b37973d347 100644 --- a/src/c10/npu/interface/AclInterface.cpp +++ b/src/c10/npu/interface/AclInterface.cpp @@ -16,6 +16,7 @@ #include "AclInterface.h" #include "c10/npu/register/FunctionLoader.h" +#include "c10/util/Exception.h" #include namespace c10 { @@ -30,6 +31,7 @@ namespace acl { REGISTER_LIBRARY(libascendcl) LOAD_FUNCTION(aclGetRecentErrMsg) +LOAD_FUNCTION(aclrtCreateEventWithFlag) const char *AclGetErrMsg() { @@ -43,6 +45,17 @@ const char *AclGetErrMsg() } return ""; } + +aclError AclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag) { + typedef aclError(*AclrtCreateEventWithFlagFunc)(aclrtEvent*, uint32_t); + static AclrtCreateEventWithFlagFunc func = nullptr; + if (func == nullptr) { + func = (AclrtCreateEventWithFlagFunc)GET_FUNC(aclrtCreateEventWithFlag); + } + TORCH_CHECK(func, "Failed to find function ", "aclrtCreateEventWithFlag"); + return func(event, flag); +} + } // namespace acl } // namespace npu } // namespace c10 diff --git a/src/c10/npu/interface/AclInterface.h b/src/c10/npu/interface/AclInterface.h index 06607c663409de6dd844e8275cabf796c07fa911..9a8a19549752498a98dffe6c3ff24934bb2daef0 100644 --- a/src/c10/npu/interface/AclInterface.h +++ b/src/c10/npu/interface/AclInterface.h @@ -12,6 +12,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +#include namespace c10 { namespace npu { @@ -22,6 +23,16 @@ namespace acl { */ const char *AclGetErrMsg(); +/** + * @ingroup AscendCL + * @brief create event instance + * + * @param event [OUT] created event + * @param flag [IN] event flag + * @retval ACL_ERROR_NONE The function is successfully executed. + * @retval OtherValues Failure + */ +aclError AclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag); } // namespace acl } // namespace npu } // namespace c10 \ No newline at end of file diff --git a/src/c10/npu/register/OptionRegister.cpp b/src/c10/npu/register/OptionRegister.cpp index 0035bb32cb44bfed8ffa2f72184e72e20b84361e..6c095f12a79cd4bfa33f0df566f970d6515e0257 100644 --- a/src/c10/npu/register/OptionRegister.cpp +++ b/src/c10/npu/register/OptionRegister.cpp @@ -13,14 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include "OptionRegister.h" #include "c10/util/Exception.h" namespace c10 { namespace npu { +OptionInterface::OptionInterface(OptionCallBack callback) { + this->callback = callback; +} + void OptionInterface::Set(const std::string& in) { this->val = in; + if (this->callback != nullptr) { + this->callback(in); + } } std::string OptionInterface::Get() { @@ -59,8 +67,20 @@ c10::optional OptionRegister::Get(const std::string& name) { OptionInterfaceBuilder::OptionInterfaceBuilder( const std::string& name, - ::std::unique_ptr& ptr) { + ::std::unique_ptr& ptr, + const std::string& type) { OptionRegister::GetInstance()->Register(name, ptr); + + // init the value if env variable. + if (type == "env") { + std::string env_name = name; + std::transform(env_name.begin(), env_name.end(), env_name.begin(), ::toupper); + char* env_val = std::getenv(env_name.c_str()); + if (env_val != nullptr) { + std::string val(env_val); + OptionRegister::GetInstance()->Set(name, val); + } + } } } // namespace register_options diff --git a/src/c10/npu/register/OptionRegister.h b/src/c10/npu/register/OptionRegister.h index c0bfa83e1027c42a3f28efb26fec6dde3c951969..e4d23d24de65fd9c889f4ed557c1d119923f2fd0 100644 --- a/src/c10/npu/register/OptionRegister.h +++ b/src/c10/npu/register/OptionRegister.h @@ -26,11 +26,16 @@ namespace c10 { namespace npu { +typedef void(*OptionCallBack) (const std::string&); /** This class is used to storage env value, and provide Set and Get to */ class OptionInterface { public: + /** + dctr + */ + OptionInterface(OptionCallBack callback=nullptr); /** This API is used to store value. */ @@ -40,10 +45,15 @@ class OptionInterface { */ std::string Get(); private: +/** + Its used to store hook. + */ + OptionCallBack callback = nullptr; std::string val; }; namespace register_options { + /** This class is used to register OptionInterface */ @@ -80,10 +90,7 @@ class OptionRegister { */ class OptionInterfaceBuilder { public: - /** - ctr - */ - OptionInterfaceBuilder(const std::string& name, ::std::unique_ptr& ptr); + OptionInterfaceBuilder(const std::string& name, ::std::unique_ptr& ptr, const std::string& type = "cli"); }; } // namespace register_options @@ -102,12 +109,25 @@ void SetOption(const std::string& key, const std::string& val); c10::optional GetOption(const std::string& key); #define REGISTER_OPTION(name) \ - REGISTER_OPTION_UNIQ(name, name) + REGISTER_OPTION_UNIQ(name, name, cli) + +#define REGISTER_OPTION_INIT_BY_ENV(name) \ + REGISTER_OPTION_UNIQ(name, name, env) -#define REGISTER_OPTION_UNIQ(id, name) \ +#define REGISTER_OPTION_UNIQ(id, name, type) \ auto options_interface_##id = \ ::std::unique_ptr(new c10::npu::OptionInterface()); \ static c10::npu::register_options::OptionInterfaceBuilder \ + register_options_interface_##id(#name, options_interface_##id, #type); + +#define REGISTER_OPTION_HOOK(name, ...) \ + REGISTER_OPTION_HOOK_UNIQ(name, name, __VA_ARGS__) + +#define REGISTER_OPTION_HOOK_UNIQ(id, name, ...) \ + auto options_interface_##id = \ + ::std::unique_ptr( \ + new c10::npu::OptionInterface(c10::npu::OptionCallBack(__VA_ARGS__))); \ + static c10::npu::register_options::OptionInterfaceBuilder \ register_options_interface_##id(#name, options_interface_##id); #define REGISTER_OPTION_BOOL_FUNCTION(func, key, defaultVal, trueVal) \ diff --git a/src/third_party/acl/inc/acl/acl_rt.h b/src/third_party/acl/inc/acl/acl_rt.h index 36af0280c76f0986c5435bf0ca3b70b1ab041a05..9e5b9aa47a0bb59dbb9ef94868fa471c3ee9d180 100644 --- a/src/third_party/acl/inc/acl/acl_rt.h +++ b/src/third_party/acl/inc/acl/acl_rt.h @@ -394,17 +394,6 @@ ACL_FUNC_VISIBILITY aclError aclrtGetDeviceCount(uint32_t *count); */ ACL_FUNC_VISIBILITY aclError aclrtCreateEvent(aclrtEvent *event); -/** - * @ingroup AscendCL - * @brief create event instance - * - * @param event [OUT] created event - * @param flag [IN] event flag - * @retval ACL_ERROR_NONE The function is successfully executed. - * @retval OtherValues Failure - */ -ACL_FUNC_VISIBILITY aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag); - /** * @ingroup AscendCL * @brief destroy event instance diff --git a/src/third_party/acl/libs/acl.cpp b/src/third_party/acl/libs/acl.cpp index cf30520c9e04c1ffeaffc746484bce3506d4d720..cf652f7e9ae06a82082de37a240f0b8ca95bbcae 100644 --- a/src/third_party/acl/libs/acl.cpp +++ b/src/third_party/acl/libs/acl.cpp @@ -25,7 +25,6 @@ aclError aclrtSynchronizeStream(aclrtStream stream){return 0;} // Event aclError aclrtQueryEvent(aclrtEvent event, aclrtEventStatus *status){return 0;} aclError aclrtCreateEvent(aclrtEvent *event){return 0;} -aclError aclrtCreateEventWithFlag(aclrtEvent *event, uint32_t flag){return 0;} aclError aclrtDestroyEvent(aclrtEvent event){return 0;} aclError aclrtRecordEvent(aclrtEvent event, aclrtStream stream){return 0;} aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event){return 0;} diff --git a/src/torch/csrc/autograd/profiler_npu.cpp b/src/torch/csrc/autograd/profiler_npu.cpp index 3007235eb7f908f5e71d0a878373a2383aaab1f2..150a68fc40d5a09885530783dc8db2d60070f9b5 100644 --- a/src/torch/csrc/autograd/profiler_npu.cpp +++ b/src/torch/csrc/autograd/profiler_npu.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -46,7 +47,7 @@ struct NPUMethods : public CUDAStubs { void npu_record(int* device, aclrtEvent* event, int64_t* cpu_ns) { TORCH_NPU_CHECK(aclrtGetDevice(device)); // TORCH_NPU_CHECK(aclrtCreateEvent(event)); - TORCH_NPU_CHECK(aclrtCreateEventWithFlag(event, ACL_EVENT_TIME_LINE)); + TORCH_NPU_CHECK(c10::npu::acl::AclrtCreateEventWithFlag(event, ACL_EVENT_TIME_LINE)); auto stream = c10::npu::getCurrentNPUStream(); *cpu_ns = getTime(); TORCH_NPU_CHECK(aclrtRecordEvent(*event, stream)); diff --git a/src/torch/csrc/npu/Module.cpp b/src/torch/csrc/npu/Module.cpp index 857c7d11272b97ec58f762654bd5d409a008d120..a4c2df60c98e28f60047f37e086c61b6ea58804b 100644 --- a/src/torch/csrc/npu/Module.cpp +++ b/src/torch/csrc/npu/Module.cpp @@ -385,37 +385,6 @@ PyObject* THNPModule_setOption_wrap(PyObject* self, PyObject* arg) { pybind11::gil_scoped_release no_gil; c10::npu::SetOption(option); } - - Py_RETURN_NONE; - END_HANDLE_TH_ERRORS -} - -PyObject* THNPModule_initDump(PyObject* _unused, PyObject* noargs) { - HANDLE_TH_ERRORS - pybind11::gil_scoped_release no_gil; - C10_NPU_CHECK(aclmdlInitDump()); - Py_RETURN_NONE; - END_HANDLE_TH_ERRORS -} - -PyObject* THNPModule_setDump(PyObject* _unused, PyObject* arg) { - HANDLE_TH_ERRORS - if (!THPUtils_checkString(arg)) { - THPUtils_setError("npu set dump error, cfg_file must string"); - } - std::string cfg_file = THPUtils_unpackString(arg); - { - pybind11::gil_scoped_release no_gil; - C10_NPU_CHECK(aclmdlSetDump(cfg_file.c_str())); - } - Py_RETURN_NONE; - END_HANDLE_TH_ERRORS -} - -PyObject* THNPModule_finalizeDump(PyObject* _unused, PyObject* noargs) { - HANDLE_TH_ERRORS - pybind11::gil_scoped_release no_gil; - C10_NPU_CHECK(aclmdlFinalizeDump()); Py_RETURN_NONE; END_HANDLE_TH_ERRORS } @@ -442,9 +411,6 @@ static struct PyMethodDef _THNPModule_methods[] = { {"_npu_lock_mutex", (PyCFunction)THNPModule_npuLockMutex, METH_NOARGS, nullptr}, {"_npu_unlock_mutex", (PyCFunction)THNPModule_npuUnlockMutex, METH_NOARGS, nullptr}, {"_npu_setOption", (PyCFunction)THNPModule_setOption_wrap, METH_O, nullptr}, - {"_npu_initDump", (PyCFunction)THNPModule_initDump, METH_NOARGS, nullptr}, - {"_npu_setDump", (PyCFunction)THNPModule_setDump, METH_O, nullptr}, - {"_npu_finalizeDump", (PyCFunction)THNPModule_finalizeDump, METH_NOARGS, nullptr}, {nullptr}}; PyMethodDef* THNPModule_methods() { diff --git a/src/torch/npu/__init__.py b/src/torch/npu/__init__.py index 9a570cedec77b003e20b8f4b0bd3f4ebfe024442..2a9d5c79f5d6d21240257ec2e86d54c817f1682a 100644 --- a/src/torch/npu/__init__.py +++ b/src/torch/npu/__init__.py @@ -291,15 +291,24 @@ if not hasattr(torch._C, '_NPUStreamBase'): def init_dump(): _lazy_init() - return torch._C._npu_initDump() + option = {} + option["mdldumpswitch"] = "init" + torch._C._npu_setOption(option) def set_dump(cfg_file): + if not os.path.exists(cfg_file): + raise AssertionError("cfg_file %s path not exists."%(cfg_file)) + cfg_file = os.path.abspath(cfg_file) _lazy_init() - return torch._C._npu_setDump(cfg_file) + option = {} + option["mdldumpconfigpath"] = cfg_file + torch._C._npu_setOption(option) def finalize_dump(): _lazy_init() - return torch._C._npu_finalizeDump() + option = {} + option["mdldumpswitch"] = "finalize" + torch._C._npu_setOption(option) from .memory import *