From d6274b4c8482910bcf053c5c4a32f6e6f4112eef Mon Sep 17 00:00:00 2001 From: pipihugh Date: Thu, 14 Apr 2022 13:39:02 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:take=E7=AE=97=E5=AD=90ApplyTensor?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- torch_npu/csrc/aten/ops/TakeKernelNpu.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/torch_npu/csrc/aten/ops/TakeKernelNpu.cpp b/torch_npu/csrc/aten/ops/TakeKernelNpu.cpp index f088f621d8d..b645a231a1d 100644 --- a/torch_npu/csrc/aten/ops/TakeKernelNpu.cpp +++ b/torch_npu/csrc/aten/ops/TakeKernelNpu.cpp @@ -57,17 +57,9 @@ at::Tensor& NPUNativeFunctions::take_out(const at::Tensor& self, const at::Tenso } at::Tensor NPUNativeFunctions::take(const at::Tensor& self, const at::Tensor& index) { - // calculate the output size - auto outputSize = input_same_output_size(index); - - // construct the output tensor of the NPU - at::Tensor result = OpPreparation::ApplyTensorWithSizes( - outputSize, - self.options()); - + at::Tensor result = OpPreparation::ApplyTensor(self, index.sizes()); take_out_nocheck(self, index, result); - return result; } } // namespace native -} // namespace at_npu \ No newline at end of file +} // namespace at_npu -- Gitee