已合并
Delete code for v1.11.0 and v2.0 (6/n) #3186
liu-jiaweikf创建于 2025年9月16日
Delete code for v1.11.0 and v2.0 (6/n) #3186
已合并
共 19 个文件变更+1-638
Dop_plugin/ops/opapi/TrueDivideKernelNpuOpApi.cpp+0-124
| @@ -1,124 +0,0 @@ | |||
| 1 | -// Copyright (c) 2023 Huawei Technologies Co., Ltd | ||
| 2 | -// Copyright (c) 2019, Facebook CORPORATION. | ||
| 3 | -// All rights reserved. | ||
| 4 | -// | ||
| 5 | -// Licensed under the BSD 3-Clause License (the "License"); | ||
| 6 | -// you may not use this file except in compliance with the License. | ||
| 7 | -// You may obtain a copy of the License at | ||
| 8 | -// | ||
| 9 | -// https://opensource.org/licenses/BSD-3-Clause | ||
| 10 | -// | ||
| 11 | -// Unless required by applicable law or agreed to in writing, software | ||
| 12 | -// distributed under the License is distributed on an "AS IS" BASIS, | ||
| 13 | -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 14 | -// See the License for the specific language governing permissions and | ||
| 15 | -// limitations under the License. | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -namespace op_api { | ||
| 20 | - | ||
| 21 | -using npu_preparation = at_npu::native::OpPreparation; | ||
| 22 | - | ||
| 23 | -static at::Tensor& div_out_npu_opapi_nocheck(const at::Tensor& self, const at::Tensor& other, at::Tensor& result) | ||
| 24 | -{ | ||
| 25 | - // executing the NPU operator | ||
| 26 | - if (other.dim() == 0 && !torch_npu::utils::is_npu(other)) { | ||
| 27 | - c10::Scalar others = other.item(); | ||
| 28 | - EXEC_NPU_CMD(aclnnDivs, self, others, result); | ||
| 29 | - } else { | ||
| 30 | - EXEC_NPU_CMD(aclnnDiv, self, other, result); | ||
| 31 | - } | ||
| 32 | - return result; | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -static at::Tensor self_tensor_to_device(const at::Tensor& tensor, const at::ScalarType result_type, | ||
| 36 | - const c10::Device device) | ||
| 37 | -{ | ||
| 38 | - if (npu_preparation::is_scalar_wrapped_to_tensor(tensor)) { | ||
| 39 | - at::Scalar scalar = tensor.item(); | ||
| 40 | - return npu_preparation::copy_scalar_to_device(scalar, result_type, device); | ||
| 41 | - } | ||
| 42 | - return tensor; | ||
| 43 | -} | ||
| 44 | - | ||
| 45 | -at::Tensor true_divide(const at::Tensor &self, const at::Tensor &other) | ||
| 46 | -{ | ||
| 47 | - DO_COMPATIBILITY(aclnnDivs, acl_op::true_divide(self, other)); | ||
| 48 | - DO_COMPATIBILITY(aclnnDiv, acl_op::true_divide(self, other)); | ||
| 49 | - // calculate the output size | ||
| 50 | - bool is_self_wrapped = npu_preparation::is_scalar_wrapped_to_tensor(self); | ||
| 51 | - at::Tensor output_tensor = is_self_wrapped ? other : self; | ||
| 52 | - auto output_size = op_infer::broadcast_ops_npu_output_size(self, other); | ||
| 53 | - at::ScalarType high_type = at::native::result_type(self, other); | ||
| 54 | - at::Tensor self_cp = self_tensor_to_device(self, high_type, output_tensor.device()); | ||
| 55 | - | ||
| 56 | - if (isIntegralType(high_type, true)) { | ||
| 57 | - high_type = at::ScalarType::Float; | ||
| 58 | - } | ||
| 59 | - // construct the output tensor of the NPU | ||
| 60 | - at::Tensor result = | ||
| 61 | - npu_preparation::apply_tensor_without_format(output_size, output_tensor.options().dtype(high_type)); | ||
| 62 | - | ||
| 63 | - // calculate the output result of the NPU | ||
| 64 | - div_out_npu_opapi_nocheck(self_cp, other, result); | ||
| 65 | - return result; | ||
| 66 | -} | ||
| 67 | - | ||
| 68 | -at::Tensor true_divide(const at::Tensor &self, const at::Scalar &other) | ||
| 69 | -{ | ||
| 70 | - DO_COMPATIBILITY(aclnnDivs, acl_op::true_divide(self, other)); | ||
| 71 | - auto output_size = op_infer::input_same_output_size(self); | ||
| 72 | - at::ScalarType high_type = at::native::result_type(self, other); | ||
| 73 | - if (isIntegralType(high_type, true)) { | ||
| 74 | - high_type = at::ScalarType::Float; | ||
| 75 | - } | ||
| 76 | - at::Tensor result = | ||
| 77 | - npu_preparation::apply_tensor_without_format(output_size, self.options().dtype(high_type)); | ||
| 78 | - EXEC_NPU_CMD(aclnnDivs, self, other, result); | ||
| 79 | - return result; | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -at::Tensor& true_divide_out(const at::Tensor& self, const at::Tensor& other, at::Tensor& result) | ||
| 83 | -{ | ||
| 84 | - DO_COMPATIBILITY(aclnnDivs, acl_op::true_divide_out(self, other, result)); | ||
| 85 | - DO_COMPATIBILITY(aclnnDiv, acl_op::true_divide_out(self, other, result)); | ||
| 86 | - // calculate the output size | ||
| 87 | - auto output_size = op_infer::broadcast_ops_npu_output_size(self, other); | ||
| 88 | - at::ScalarType result_type = at::native::result_type(self, other); | ||
| 89 | - if (isIntegralType(result_type, true)) { | ||
| 90 | - result_type = at::ScalarType::Float; | ||
| 91 | - } | ||
| 92 | - if (isFloatingType(result.scalar_type())) { | ||
| 93 | - result_type = result.scalar_type(); | ||
| 94 | - } | ||
| 95 | - at::Tensor self_cp = self_tensor_to_device(self, result_type, result.device()); | ||
| 96 | - npu_preparation::check_tensor({self, other}, result, result_type, output_size); | ||
| 97 | - | ||
| 98 | - // calculate the output result of the NPU | ||
| 99 | - div_out_npu_opapi_nocheck(self_cp, other, result); | ||
| 100 | - return result; | ||
| 101 | -} | ||
| 102 | - | ||
| 103 | -at::Tensor& true_divide_(at::Tensor& self, const at::Tensor& other) | ||
| 104 | -{ | ||
| 105 | - DO_COMPATIBILITY(aclnnInplaceDiv, acl_op::true_divide_(self, other)); | ||
| 106 | - npu_preparation::check_memory({self, other}, {self}); | ||
| 107 | - | ||
| 108 | - if (other.dim() == 0 && !torch_npu::utils::is_npu(other)) { | ||
| 109 | - c10::Scalar other_value = other.item(); | ||
| 110 | - true_divide_(self, other_value); | ||
| 111 | - } else { | ||
| 112 | - EXEC_NPU_CMD(aclnnInplaceDiv, self, other); | ||
| 113 | - } | ||
| 114 | - return self; | ||
| 115 | -} | ||
| 116 | - | ||
| 117 | -at::Tensor& true_divide_(at::Tensor& self, const at::Scalar& other) | ||
| 118 | -{ | ||
| 119 | - DO_COMPATIBILITY(aclnnInplaceDivs, acl_op::true_divide_(self, other)); | ||
| 120 | - EXEC_NPU_CMD(aclnnInplaceDivs, self, other); | ||
| 121 | - return self; | ||
| 122 | -} | ||
| 123 | - | ||
| 124 | -} // namespace op_api | ||
| @@ -20,7 +20,7 @@ | |||
| 20 | namespace op_api { | 20 | namespace op_api { |
| 21 | using npu_preparation = at_npu::native::OpPreparation; | 21 | using npu_preparation = at_npu::native::OpPreparation; |
| 22 | 22 | ||
| 23 | -#if VERSION_BETWEEN(V1R11, V2R1) | 23 | +#if VERSION_BETWEEN(V2R1, V2R1) |
| 24 | std::tuple<at::Tensor, at::Tensor, at::Tensor> _unique2( | 24 | std::tuple<at::Tensor, at::Tensor, at::Tensor> _unique2( |
| 25 | const at::Tensor& self, | 25 | const at::Tensor& self, |
| 26 | bool sorted, | 26 | bool sorted, |
| @@ -60,30 +60,4 @@ at::Tensor upsample_bicubic2d_backward( | |||
| 60 | scales_h_attr, scales_w_attr, grad_input); | 60 | scales_h_attr, scales_w_attr, grad_input); |
| 61 | return grad_input; | 61 | return grad_input; |
| 62 | } | 62 | } |
| 63 | - | ||
| 64 | - | ||
| 65 | -at::Tensor upsample_bicubic2d_backward( | ||
| 66 | - const at::Tensor& grad_output, | ||
| 67 | - c10::optional<at::IntArrayRef> output_size, | ||
| 68 | - at::IntArrayRef input_size, | ||
| 69 | - bool align_corners, | ||
| 70 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 71 | -{ | ||
| 72 | - DO_COMPATIBILITY(aclnnUpsampleBicubic2dBackward, acl_op::upsample_bicubic2d_backward(grad_output, output_size, | ||
| 73 | - input_size, align_corners, | ||
| 74 | - scale_factors)); | ||
| 75 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 76 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 77 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 78 | - double scales_h_attr = scales_h.value_or(0); | ||
| 79 | - double scales_w_attr = scales_w.value_or(0); | ||
| 80 | - | ||
| 81 | - auto outputsize = at::IntArrayRef(osize); | ||
| 82 | - at::Tensor grad_input = npu_preparation::apply_tensor(grad_output, input_size); | ||
| 83 | - | ||
| 84 | - EXEC_NPU_CMD(aclnnUpsampleBicubic2dBackward, grad_output, outputsize, input_size, align_corners, | ||
| 85 | - scales_h_attr, scales_w_attr, grad_input); | ||
| 86 | - return grad_input; | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | } | 63 | } |
| @@ -50,19 +50,4 @@ at::Tensor upsample_bicubic2d(const at::Tensor& self, at::IntArrayRef output_siz | |||
| 50 | upsample_bicubic2d_opapi(self, output_size, align_corners, scales_h, scales_w, result); | 50 | upsample_bicubic2d_opapi(self, output_size, align_corners, scales_h, scales_w, result); |
| 51 | return result; | 51 | return result; |
| 52 | } | 52 | } |
| 53 | - | ||
| 54 | - | ||
| 55 | -at::Tensor upsample_bicubic2d(const at::Tensor& self, c10::optional<at::IntArrayRef> output_size, | ||
| 56 | - bool align_corners, c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 57 | -{ | ||
| 58 | - DO_COMPATIBILITY(aclnnUpsampleBicubic2d, | ||
| 59 | - acl_op::upsample_bicubic2d(self, output_size, align_corners, scale_factors)); | ||
| 60 | - auto osize = op_infer::upsample_infershape_with_scale(self.sizes(), output_size, scale_factors); | ||
| 61 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 62 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 63 | - at::Tensor result = op_api::upsample_bicubic2d(self, osize, align_corners, scales_h, scales_w); | ||
| 64 | - return result; | ||
| 65 | -} | ||
| 66 | - | ||
| 67 | - | ||
| 68 | } // namespace op_api | 53 | } // namespace op_api |
| @@ -101,56 +101,4 @@ at::Tensor& upsample_bilinear2d_backward_out( | |||
| 101 | scales_h_attr, scales_w_attr, grad_input); | 101 | scales_h_attr, scales_w_attr, grad_input); |
| 102 | return grad_input; | 102 | return grad_input; |
| 103 | } | 103 | } |
| 104 | - | ||
| 105 | - | ||
| 106 | -at::Tensor upsample_bilinear2d_backward( | ||
| 107 | - const at::Tensor& grad_output, | ||
| 108 | - c10::optional<at::IntArrayRef> output_size, | ||
| 109 | - at::IntArrayRef input_size, | ||
| 110 | - bool align_corners, | ||
| 111 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 112 | -{ | ||
| 113 | - DO_COMPATIBILITY(aclnnUpsampleBilinear2dBackwardV2, | ||
| 114 | - op_api::upsample_bilinear2d_backward_old(grad_output, output_size, input_size, | ||
| 115 | - align_corners, scale_factors)); | ||
| 116 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 117 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 118 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 119 | - double scales_h_attr = scales_h.value_or(0); | ||
| 120 | - double scales_w_attr = scales_w.value_or(0); | ||
| 121 | - | ||
| 122 | - auto outputsize = at::IntArrayRef(osize); | ||
| 123 | - auto outputSize = input_size; | ||
| 124 | - at::Tensor grad_input = npu_preparation::apply_tensor(grad_output, outputSize); | ||
| 125 | - | ||
| 126 | - EXEC_NPU_CMD(aclnnUpsampleBilinear2dBackwardV2, grad_output, outputsize, input_size, align_corners, | ||
| 127 | - scales_h_attr, scales_w_attr, grad_input); | ||
| 128 | - return grad_input; | ||
| 129 | -} | ||
| 130 | - | ||
| 131 | -at::Tensor upsample_bilinear2d_backward_old( | ||
| 132 | - const at::Tensor& grad_output, | ||
| 133 | - c10::optional<at::IntArrayRef> output_size, | ||
| 134 | - at::IntArrayRef input_size, | ||
| 135 | - bool align_corners, | ||
| 136 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 137 | -{ | ||
| 138 | - DO_COMPATIBILITY(aclnnUpsampleBilinear2dBackward, | ||
| 139 | - acl_op::upsample_bilinear2d_backward(grad_output, output_size, input_size, | ||
| 140 | - align_corners, scale_factors)); | ||
| 141 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 142 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 143 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 144 | - double scales_h_attr = scales_h.value_or(0); | ||
| 145 | - double scales_w_attr = scales_w.value_or(0); | ||
| 146 | - | ||
| 147 | - auto outputsize = at::IntArrayRef(osize); | ||
| 148 | - auto outputSize = input_size; | ||
| 149 | - at::Tensor grad_input = npu_preparation::apply_tensor(grad_output, outputSize); | ||
| 150 | - | ||
| 151 | - EXEC_NPU_CMD(aclnnUpsampleBilinear2dBackward, grad_output, outputsize, input_size, align_corners, | ||
| 152 | - scales_h_attr, scales_w_attr, grad_input); | ||
| 153 | - return grad_input; | ||
| 154 | -} | ||
| 155 | - | ||
| 156 | } | 104 | } |
| @@ -55,32 +55,4 @@ at::Tensor upsample_bilinear2d(const at::Tensor& self_ex, at::IntArrayRef output | |||
| 55 | EXEC_NPU_CMD(aclnnUpsampleBilinear2d, self, output_size, align_corners, scales_h_attr, scales_w_attr, result); | 55 | EXEC_NPU_CMD(aclnnUpsampleBilinear2d, self, output_size, align_corners, scales_h_attr, scales_w_attr, result); |
| 56 | return result; | 56 | return result; |
| 57 | } | 57 | } |
| 58 | - | ||
| 59 | - | ||
| 60 | -at::Tensor upsample_bilinear2d( | ||
| 61 | - const at::Tensor& self_ex, | ||
| 62 | - c10::optional<at::IntArrayRef> output_size, | ||
| 63 | - bool align_corners, | ||
| 64 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 65 | -{ | ||
| 66 | - DO_COMPATIBILITY(aclnnUpsampleBilinear2d, | ||
| 67 | - acl_op::upsample_bilinear2d(self_ex, output_size, align_corners, scale_factors)); | ||
| 68 | - at::Tensor self = self_ex; | ||
| 69 | - auto osize = op_infer::upsample_infershape_with_scale(self_ex.sizes(), output_size, scale_factors); | ||
| 70 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 71 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 72 | - | ||
| 73 | - TORCH_CHECK(self.scalar_type() != at::ScalarType::Double, "upsample_binlinear_2d not support torch.fp64 dtypes", | ||
| 74 | - OPS_ERROR(ErrCode::TYPE)); | ||
| 75 | - | ||
| 76 | - auto output_osize = op_infer::upsample_bilinear2d_npu_output_size(self, osize); | ||
| 77 | - at::Tensor result = npu_preparation::apply_tensor_without_format(output_osize, self.options()); | ||
| 78 | - | ||
| 79 | - auto output_osize2 = at::IntArrayRef(osize); | ||
| 80 | - double scales_h_attr = scales_h.value_or(1); | ||
| 81 | - double scales_w_attr = scales_w.value_or(1); | ||
| 82 | - EXEC_NPU_CMD(aclnnUpsampleBilinear2d, self, output_osize2, align_corners, scales_h_attr, scales_w_attr, result); | ||
| 83 | - return result; | ||
| 84 | -} | ||
| 85 | - | ||
| 86 | } | 58 | } |
| @@ -37,28 +37,4 @@ at::Tensor upsample_linear1d_backward( | |||
| 37 | scales_attr, grad_input); | 37 | scales_attr, grad_input); |
| 38 | return grad_input; | 38 | return grad_input; |
| 39 | } | 39 | } |
| 40 | - | ||
| 41 | - | ||
| 42 | -at::Tensor upsample_linear1d_backward( | ||
| 43 | - const at::Tensor& grad_output, | ||
| 44 | - c10::optional<at::IntArrayRef> output_size, | ||
| 45 | - at::IntArrayRef input_size, | ||
| 46 | - bool align_corners, | ||
| 47 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 48 | -{ | ||
| 49 | - DO_COMPATIBILITY(aclnnUpsampleLinear1dBackward, | ||
| 50 | - acl_op::upsample_linear1d_backward(grad_output, output_size, input_size, | ||
| 51 | - align_corners, scale_factors)); | ||
| 52 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 53 | - auto outputsize = at::IntArrayRef(osize); | ||
| 54 | - auto scales_l = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 55 | - double scales_l_attr = scales_l.value_or(0); | ||
| 56 | - | ||
| 57 | - at::Tensor grad_input = npu_preparation::apply_tensor(grad_output, input_size); | ||
| 58 | - | ||
| 59 | - EXEC_NPU_CMD(aclnnUpsampleLinear1dBackward, grad_output, outputsize, input_size, align_corners, | ||
| 60 | - scales_l_attr, grad_input); | ||
| 61 | - return grad_input; | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | } | 40 | } |
| @@ -48,23 +48,4 @@ at::Tensor upsample_linear1d(const at::Tensor &self, at::IntArrayRef output_size | |||
| 48 | EXEC_NPU_CMD(aclnnUpsampleLinear1d, self, output_size, align_corners, scales_h_attr, result); | 48 | EXEC_NPU_CMD(aclnnUpsampleLinear1d, self, output_size, align_corners, scales_h_attr, result); |
| 49 | return result; | 49 | return result; |
| 50 | } | 50 | } |
| 51 | - | ||
| 52 | - | ||
| 53 | -at::Tensor upsample_linear1d(const at::Tensor &self, c10::optional<at::IntArrayRef> output_size, bool align_corners, | ||
| 54 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 55 | -{ | ||
| 56 | - DO_COMPATIBILITY(aclnnUpsampleLinear1d, acl_op::upsample_linear1d(self, output_size, align_corners, scale_factors)); | ||
| 57 | - auto osize = op_infer::upsample_infershape_with_scale(self.sizes(), output_size, scale_factors); | ||
| 58 | - auto scales = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 59 | - auto outsize = at::IntArrayRef(osize); | ||
| 60 | - auto out_size = op_infer::upsample_linear1d_npu_output_size(self, outsize); | ||
| 61 | - constexpr int DEFAULT_SCALES = -1; | ||
| 62 | - double scales_h_attr = scales.value_or(DEFAULT_SCALES); | ||
| 63 | - at::Tensor result = npu_preparation::apply_tensor_without_format(out_size, self.options()); | ||
| 64 | - | ||
| 65 | - EXEC_NPU_CMD(aclnnUpsampleLinear1d, self, outsize, align_corners, scales_h_attr, result); | ||
| 66 | - return result; | ||
| 67 | -} | ||
| 68 | - | ||
| 69 | - | ||
| 70 | } // namespace op_api | 51 | } // namespace op_api |
| @@ -49,26 +49,4 @@ at::Tensor upsample_nearest1d_backward( | |||
| 49 | EXEC_NPU_CMD(aclnnUpsampleNearest1dBackward, grad_output, output_size, input_size, scales_attr, grad_input); | 49 | EXEC_NPU_CMD(aclnnUpsampleNearest1dBackward, grad_output, output_size, input_size, scales_attr, grad_input); |
| 50 | return grad_input; | 50 | return grad_input; |
| 51 | } | 51 | } |
| 52 | - | ||
| 53 | - | ||
| 54 | -at::Tensor upsample_nearest1d_backward( | ||
| 55 | - const at::Tensor& grad_output, | ||
| 56 | - c10::optional<at::IntArrayRef> output_size, | ||
| 57 | - at::IntArrayRef input_size, | ||
| 58 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 59 | -{ | ||
| 60 | - DO_COMPATIBILITY(aclnnUpsampleNearest1dBackward, | ||
| 61 | - acl_op::upsample_nearest1d_backward(grad_output, output_size, input_size, scale_factors)); | ||
| 62 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 63 | - auto output_osize = at::IntArrayRef(osize); | ||
| 64 | - auto scales = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 65 | - constexpr int DEFAULT_SCALES = -1; | ||
| 66 | - double scales_attr = scales.value_or(DEFAULT_SCALES); | ||
| 67 | - at::Tensor grad_input = npu_preparation::apply_tensor_without_format(grad_output, input_size); | ||
| 68 | - | ||
| 69 | - EXEC_NPU_CMD(aclnnUpsampleNearest1dBackward, grad_output, output_osize, input_size, | ||
| 70 | - scales_attr, grad_input); | ||
| 71 | - return grad_input; | ||
| 72 | -} | ||
| 73 | - | ||
| 74 | } | 52 | } |
| @@ -66,27 +66,4 @@ at::Tensor upsample_nearest1d(const at::Tensor& self, | |||
| 66 | EXEC_NPU_CMD(aclnnUpsampleNearest1dV2, self, output_size, scale_l, result); | 66 | EXEC_NPU_CMD(aclnnUpsampleNearest1dV2, self, output_size, scale_l, result); |
| 67 | return result; | 67 | return result; |
| 68 | } | 68 | } |
| 69 | - | ||
| 70 | - | ||
| 71 | -at::Tensor upsample_nearest1d(const at::Tensor& input, | ||
| 72 | - c10::optional<at::IntArrayRef> output_size, | ||
| 73 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 74 | -{ | ||
| 75 | - // 兼容性处理,没有v2回调原先版本 | ||
| 76 | - DO_COMPATIBILITY(aclnnUpsampleNearest1dV2, op_api::upsample_nearest1d_old(input, output_size, scale_factors)); | ||
| 77 | - auto compute_size = op_infer::upsample_infershape_with_scale(input.sizes(), output_size, scale_factors); | ||
| 78 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 79 | - return op_api::upsample_nearest1d(input, compute_size, scales_w); | ||
| 80 | -} | ||
| 81 | - | ||
| 82 | -at::Tensor upsample_nearest1d_old(const at::Tensor& input, | ||
| 83 | - c10::optional<at::IntArrayRef> output_size, | ||
| 84 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 85 | -{ | ||
| 86 | - DO_COMPATIBILITY(aclnnUpsampleNearest1d, acl_op::upsample_nearest1d(input, output_size, scale_factors)); | ||
| 87 | - auto compute_size = op_infer::upsample_infershape_with_scale(input.sizes(), output_size, scale_factors); | ||
| 88 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 89 | - return op_api::upsample_nearest1d_old(input, compute_size, scales_w); | ||
| 90 | -} | ||
| 91 | - | ||
| 92 | } | 69 | } |
| @@ -50,26 +50,4 @@ at::Tensor upsample_nearest2d_backward( | |||
| 50 | EXEC_NPU_CMD(aclnnUpsampleNearest2dBackward, grad_output, output_size, input_size, scales_h_attr, scales_w_attr, grad_input); | 50 | EXEC_NPU_CMD(aclnnUpsampleNearest2dBackward, grad_output, output_size, input_size, scales_h_attr, scales_w_attr, grad_input); |
| 51 | return grad_input; | 51 | return grad_input; |
| 52 | } | 52 | } |
| 53 | - | ||
| 54 | - | ||
| 55 | -at::Tensor upsample_nearest2d_backward( | ||
| 56 | - const at::Tensor& grad_output, | ||
| 57 | - c10::optional<at::IntArrayRef> output_size, | ||
| 58 | - at::IntArrayRef input_size, | ||
| 59 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 60 | -{ | ||
| 61 | - DO_COMPATIBILITY(aclnnUpsampleNearest2dBackward, acl_op::upsample_nearest2d_backward(grad_output, output_size, input_size, scale_factors)); | ||
| 62 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 63 | - auto output_osize = at::IntArrayRef(osize); | ||
| 64 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 65 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 66 | - double scales_h_attr = scales_h.value_or(-1); | ||
| 67 | - double scales_w_attr = scales_w.value_or(-1); | ||
| 68 | - at::Tensor grad_input = npu_preparation::apply_tensor_without_format(grad_output, input_size); | ||
| 69 | - | ||
| 70 | - EXEC_NPU_CMD(aclnnUpsampleNearest2dBackward, grad_output, output_osize, input_size, scales_h_attr, scales_w_attr, grad_input); | ||
| 71 | - return grad_input; | ||
| 72 | -} | ||
| 73 | - | ||
| 74 | - | ||
| 75 | } | 53 | } |
| @@ -93,19 +93,4 @@ at::Tensor upsample_nearest2d( | |||
| 93 | EXEC_NPU_CMD(aclnnUpsampleNearest2dV2, self, output_size, scale_h, scale_w, out); | 93 | EXEC_NPU_CMD(aclnnUpsampleNearest2dV2, self, output_size, scale_h, scale_w, out); |
| 94 | return out; | 94 | return out; |
| 95 | } | 95 | } |
| 96 | - | ||
| 97 | - | ||
| 98 | -at::Tensor upsample_nearest2d( | ||
| 99 | - const at::Tensor& input, | ||
| 100 | - c10::optional<at::IntArrayRef> output_size, | ||
| 101 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 102 | -{ | ||
| 103 | - auto osize = op_infer::upsample_infershape_with_scale(input.sizes(), output_size, scale_factors); | ||
| 104 | - auto scale_h = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 105 | - auto scale_w = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 106 | - | ||
| 107 | - return op_api::upsample_nearest2d(input, osize, scale_h, scale_w); | ||
| 108 | -} | ||
| 109 | - | ||
| 110 | - | ||
| 111 | } | 96 | } |
| @@ -67,41 +67,4 @@ at::Tensor upsample_nearest3d_backward( | |||
| 67 | grad_input); | 67 | grad_input); |
| 68 | return grad_input; | 68 | return grad_input; |
| 69 | } | 69 | } |
| 70 | - | ||
| 71 | - | ||
| 72 | -at::Tensor upsample_nearest3d_backward( | ||
| 73 | - const at::Tensor& grad_output, | ||
| 74 | - c10::optional<at::IntArrayRef> output_size, | ||
| 75 | - at::IntArrayRef input_size, | ||
| 76 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 77 | -{ | ||
| 78 | - DO_COMPATIBILITY(aclnnUpsampleNearest3dBackward, | ||
| 79 | - acl_op::upsample_nearest3d_backward( | ||
| 80 | - grad_output, | ||
| 81 | - output_size, | ||
| 82 | - input_size, | ||
| 83 | - scale_factors)); | ||
| 84 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 85 | - auto output_osize = at::IntArrayRef(osize); | ||
| 86 | - | ||
| 87 | - auto scales_d = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 88 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 89 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 2); | ||
| 90 | - double scales_d_attr = scales_d.value_or(0); | ||
| 91 | - double scales_h_attr = scales_h.value_or(0); | ||
| 92 | - double scales_w_attr = scales_w.value_or(0); | ||
| 93 | - | ||
| 94 | - at::Tensor grad_input = npu_preparation::apply_tensor_without_format(grad_output, input_size); | ||
| 95 | - EXEC_NPU_CMD( | ||
| 96 | - aclnnUpsampleNearest3dBackward, | ||
| 97 | - grad_output, | ||
| 98 | - output_osize, | ||
| 99 | - input_size, | ||
| 100 | - scales_d_attr, | ||
| 101 | - scales_h_attr, | ||
| 102 | - scales_w_attr, | ||
| 103 | - grad_input); | ||
| 104 | - return grad_input; | ||
| 105 | -} | ||
| 106 | - | ||
| 107 | } | 70 | } |
| @@ -56,30 +56,4 @@ at::Tensor upsample_nearest3d( | |||
| 56 | EXEC_NPU_CMD(aclnnUpsampleNearest3d, self, output_size, scales_d_attr, scales_h_attr, scales_w_attr, result); | 56 | EXEC_NPU_CMD(aclnnUpsampleNearest3d, self, output_size, scales_d_attr, scales_h_attr, scales_w_attr, result); |
| 57 | return result; | 57 | return result; |
| 58 | } | 58 | } |
| 59 | - | ||
| 60 | - | ||
| 61 | -at::Tensor upsample_nearest3d( | ||
| 62 | - const at::Tensor& input, | ||
| 63 | - c10::optional<at::IntArrayRef> output_size, | ||
| 64 | - c10::optional<at::ArrayRef<double>> scale_factors) | ||
| 65 | -{ | ||
| 66 | - DO_COMPATIBILITY(aclnnUpsampleNearest3d, | ||
| 67 | - acl_op::upsample_nearest3d(input, output_size, scale_factors)); | ||
| 68 | - auto osize = op_infer::upsample_infershape_with_scale(input.sizes(), output_size, scale_factors); | ||
| 69 | - | ||
| 70 | - auto scales_d = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 71 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 72 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 2); | ||
| 73 | - double scales_d_attr = scales_d.value_or(0); | ||
| 74 | - double scales_h_attr = scales_h.value_or(0); | ||
| 75 | - double scales_w_attr = scales_w.value_or(0); | ||
| 76 | - | ||
| 77 | - auto output_size_vec = op_infer::upsample_nearest3d_npu_output_size(input, osize); | ||
| 78 | - at::Tensor result = npu_preparation::apply_tensor_without_format(input, output_size_vec); | ||
| 79 | - auto output_osize = at::IntArrayRef(osize); | ||
| 80 | - | ||
| 81 | - EXEC_NPU_CMD(aclnnUpsampleNearest3d, input, output_osize, scales_d_attr, scales_h_attr, scales_w_attr, result); | ||
| 82 | - return result; | ||
| 83 | -} | ||
| 84 | - | ||
| 85 | } | 59 | } |
| @@ -71,24 +71,4 @@ at::Tensor upsample_trilinear3d_backward( | |||
| 71 | return upsample_trilinear3d_backward_opapi(grad_output, output_size, input_size, align_corners, scales_d, | 71 | return upsample_trilinear3d_backward_opapi(grad_output, output_size, input_size, align_corners, scales_d, |
| 72 | scales_h, scales_w, result); | 72 | scales_h, scales_w, result); |
| 73 | } | 73 | } |
| 74 | - | ||
| 75 | - | ||
| 76 | -at::Tensor upsample_trilinear3d_backward( | ||
| 77 | - const at::Tensor& grad_output, | ||
| 78 | - c10::optional<at::IntArrayRef> output_size, | ||
| 79 | - at::IntArrayRef input_size, | ||
| 80 | - bool align_corners, | ||
| 81 | - c10::optional<at::ArrayRef<double>> scale_factors) { | ||
| 82 | - DO_COMPATIBILITY(aclnnUpsampleTrilinear3dBackward, | ||
| 83 | - acl_op::upsample_trilinear3d_backward(grad_output, output_size, input_size, | ||
| 84 | - align_corners, scale_factors)); | ||
| 85 | - auto osize = op_infer::upsample_infershape_with_scale(input_size, output_size, scale_factors); | ||
| 86 | - auto scales_d = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 87 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 88 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 2); | ||
| 89 | - return op_api::upsample_trilinear3d_backward(grad_output, osize, input_size, align_corners, scales_d, | ||
| 90 | - scales_h, scales_w); | ||
| 91 | -} | ||
| 92 | - | ||
| 93 | - | ||
| 94 | } | 74 | } |
| @@ -68,22 +68,4 @@ at::Tensor upsample_trilinear3d( | |||
| 68 | upsample_trilinear3d_opapi(input, output_size, align_corners, scales_d, scales_h, scales_w, result); | 68 | upsample_trilinear3d_opapi(input, output_size, align_corners, scales_d, scales_h, scales_w, result); |
| 69 | return result; | 69 | return result; |
| 70 | } | 70 | } |
| 71 | - | ||
| 72 | - | ||
| 73 | -at::Tensor upsample_trilinear3d( | ||
| 74 | - const at::Tensor& input, | ||
| 75 | - c10::optional<at::IntArrayRef> output_size, | ||
| 76 | - bool align_corners, | ||
| 77 | - c10::optional<at::ArrayRef<double>> scale_factors) { | ||
| 78 | - DO_COMPATIBILITY(aclnnUpsampleTrilinear3d, | ||
| 79 | - acl_op::upsample_trilinear3d(input, output_size, align_corners, scale_factors)); | ||
| 80 | - auto osize = op_infer::upsample_infershape_with_scale(input.sizes(), output_size, scale_factors); | ||
| 81 | - auto scales_d = op_plugin::utils::get_scale_value(scale_factors, 0); | ||
| 82 | - auto scales_h = op_plugin::utils::get_scale_value(scale_factors, 1); | ||
| 83 | - auto scales_w = op_plugin::utils::get_scale_value(scale_factors, 2); | ||
| 84 | - at::Tensor result = op_api::upsample_trilinear3d( | ||
| 85 | - input, osize, align_corners, scales_d, scales_h, scales_w); | ||
| 86 | - return result; | ||
| 87 | -} | ||
| 88 | - | ||
| 89 | } | 71 | } |
| @@ -18,70 +18,6 @@ | |||
| 18 | namespace op_api { | 18 | namespace op_api { |
| 19 | using npu_preparation = at_npu::native::OpPreparation; | 19 | using npu_preparation = at_npu::native::OpPreparation; |
| 20 | 20 | ||
| 21 | - | ||
| 22 | -at::Tensor &var_out( | ||
| 23 | - const at::Tensor &self, | ||
| 24 | - c10::optional<at::IntArrayRef> dim, | ||
| 25 | - c10::optional<int64_t> correction, | ||
| 26 | - bool keepdim, | ||
| 27 | - at::Tensor &out) | ||
| 28 | -{ | ||
| 29 | - DO_COMPATIBILITY(aclnnVarCorrection, acl_op::var_out(self, dim, correction, keepdim, out)); | ||
| 30 | - c10::SmallVector<int64_t, SIZE> real_dim = {}; | ||
| 31 | - if (dim.has_value()) { | ||
| 32 | - real_dim = op_infer::array_to_small_vector(dim.value()); | ||
| 33 | - } | ||
| 34 | - auto output_size = op_infer::reduce_ops_npu_output_size(self, real_dim, keepdim); | ||
| 35 | - auto real_correction = correction.has_value() ? correction.value() : 1; | ||
| 36 | - | ||
| 37 | - at_npu::native::OpPreparation::check_tensor({self}, out, out, output_size); | ||
| 38 | - | ||
| 39 | - EXEC_NPU_CMD(aclnnVarCorrection, self, dim, real_correction, keepdim, out); | ||
| 40 | - return out; | ||
| 41 | -} | ||
| 42 | - | ||
| 43 | -at::Tensor var( | ||
| 44 | - const at::Tensor &self, | ||
| 45 | - c10::optional<at::IntArrayRef> dim, | ||
| 46 | - c10::optional<int64_t> correction, | ||
| 47 | - bool keepdim) | ||
| 48 | -{ | ||
| 49 | - DO_COMPATIBILITY(aclnnVarCorrection, acl_op::var(self, dim, correction, keepdim)); | ||
| 50 | - c10::SmallVector<int64_t, SIZE> real_dim = {}; | ||
| 51 | - if (dim.has_value()) { | ||
| 52 | - real_dim = op_infer::array_to_small_vector(dim.value()); | ||
| 53 | - } | ||
| 54 | - auto output_size = op_infer::reduce_ops_npu_output_size(self, real_dim, keepdim); | ||
| 55 | - auto real_correction = correction.has_value() ? correction.value() : 1; | ||
| 56 | - auto result = at_npu::native::OpPreparation::apply_tensor_without_format(output_size, self.options()); | ||
| 57 | - | ||
| 58 | - at_npu::native::OpPreparation::check_tensor({self}, result, self, output_size); | ||
| 59 | - | ||
| 60 | - EXEC_NPU_CMD(aclnnVarCorrection, self, dim, real_correction, keepdim, result); | ||
| 61 | - return result; | ||
| 62 | -} | ||
| 63 | - | ||
| 64 | -std::tuple<at::Tensor, at::Tensor> var_mean( | ||
| 65 | - const at::Tensor &self, | ||
| 66 | - c10::optional<at::IntArrayRef> dims, | ||
| 67 | - c10::optional<int64_t> correction, bool keepdim) | ||
| 68 | -{ | ||
| 69 | - DO_COMPATIBILITY(aclnnVarMean, acl_op::var_mean(self, dims, correction, keepdim)); | ||
| 70 | - c10::SmallVector<int64_t, N> real_dim = op_plugin::utils::get_dimlist_for_tensor(self); | ||
| 71 | - if (dims.has_value()) { | ||
| 72 | - real_dim = op_infer::array_to_small_vector(dims.value()); | ||
| 73 | - } | ||
| 74 | - int64_t real_correction = correction.has_value() ? correction.value() : 1; | ||
| 75 | - auto output_size = op_infer::reduce_ops_npu_output_size(self, real_dim, keepdim); | ||
| 76 | - auto var = at_npu::native::OpPreparation::apply_tensor_without_format(output_size, self.options()); | ||
| 77 | - auto mean = at_npu::native::OpPreparation::apply_tensor_without_format(output_size, self.options()); | ||
| 78 | - | ||
| 79 | - EXEC_NPU_CMD(aclnnVarMean, self, dims, real_correction, keepdim, var, mean); | ||
| 80 | - return std::tuple<at::Tensor, at::Tensor>(var, mean); | ||
| 81 | -} | ||
| 82 | - | ||
| 83 | - | ||
| 84 | - | ||
| 85 | at::Tensor& var_out( | 21 | at::Tensor& var_out( |
| 86 | const at::Tensor& self, | 22 | const at::Tensor& self, |
| 87 | at::OptionalIntArrayRef dim, | 23 | at::OptionalIntArrayRef dim, |
| @@ -153,5 +89,4 @@ std::tuple<at::Tensor, at::Tensor> var_mean( | |||
| 153 | EXEC_NPU_CMD(aclnnVarMean, self, rd, real_correction, keepdim, var, mean); | 89 | EXEC_NPU_CMD(aclnnVarMean, self, rd, real_correction, keepdim, var, mean); |
| 154 | return std::tuple<at::Tensor, at::Tensor>(var, mean); | 90 | return std::tuple<at::Tensor, at::Tensor>(var, mean); |
| 155 | } | 91 | } |
| 156 | - | ||
| 157 | } // namespace op_api | 92 | } // namespace op_api |
| @@ -25,73 +25,6 @@ vector<at::Tensor> where(const at::Tensor &condition) | |||
| 25 | return at::native::where(condition); | 25 | return at::native::where(condition); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | - | ||
| 29 | -at::Tensor where( | ||
| 30 | - const at::Tensor& condition, | ||
| 31 | - const at::Tensor& self, | ||
| 32 | - const at::Tensor& other) | ||
| 33 | -{ | ||
| 34 | - DO_COMPATIBILITY(aclnnSWhere, acl_op::where(condition, self, other)); | ||
| 35 | - return at::_s_where(condition, self, other); | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -at::Tensor& where_out( | ||
| 41 | - const at::Tensor& condition, | ||
| 42 | - const at::Tensor& self, | ||
| 43 | - const at::Tensor& other, | ||
| 44 | - at::Tensor& out) | ||
| 45 | -{ | ||
| 46 | - DO_COMPATIBILITY(aclnnSWhere, acl_op::where_out(condition, self, other, out)); | ||
| 47 | - | ||
| 48 | - auto broadcast_output_size = op_infer::broadcast_ops_npu_output_size(self, other); | ||
| 49 | - auto output_size = op_infer::broadcast_ops_npu_output_size(condition.sizes(), broadcast_output_size); | ||
| 50 | - | ||
| 51 | - at::Tensor self_cp; | ||
| 52 | - at::Tensor other_cp; | ||
| 53 | - if (self.dtype() != other.dtype()) { | ||
| 54 | - auto result_type = at::native::result_type(self, other); | ||
| 55 | - self_cp = npu_dtype_cast(self, result_type); | ||
| 56 | - other_cp = npu_dtype_cast(other, result_type); | ||
| 57 | - } else { | ||
| 58 | - self_cp = self; | ||
| 59 | - other_cp = other; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - npu_preparation::check_tensor({condition, self_cp, other_cp}, out, out, output_size); | ||
| 63 | - | ||
| 64 | - EXEC_NPU_CMD(aclnnSWhere, condition, self_cp, other_cp, out); | ||
| 65 | - | ||
| 66 | - return out; | ||
| 67 | -} | ||
| 68 | - | ||
| 69 | -at::Tensor where( | ||
| 70 | - const at::Tensor& condition, | ||
| 71 | - const at::Tensor& self, | ||
| 72 | - const at::Tensor& other) | ||
| 73 | -{ | ||
| 74 | - DO_COMPATIBILITY(aclnnSWhere, acl_op::where(condition, self, other)); | ||
| 75 | - auto broadcast_output_size = op_infer::broadcast_ops_npu_output_size(self, other); | ||
| 76 | - auto output_size = op_infer::broadcast_ops_npu_output_size(condition.sizes(), broadcast_output_size); | ||
| 77 | - at::Tensor self_cp; | ||
| 78 | - at::Tensor other_cp; | ||
| 79 | - if (self.dtype() != other.dtype()) { | ||
| 80 | - auto result_type = at::native::result_type(self, other); | ||
| 81 | - self_cp = npu_dtype_cast(self, result_type); | ||
| 82 | - other_cp = npu_dtype_cast(other, result_type); | ||
| 83 | - } else { | ||
| 84 | - self_cp = self; | ||
| 85 | - other_cp = other; | ||
| 86 | - } | ||
| 87 | - at::Tensor result = npu_preparation::apply_tensor_without_format(self_cp, output_size); | ||
| 88 | - EXEC_NPU_CMD(aclnnSWhere, condition, self_cp, other_cp, result); | ||
| 89 | - | ||
| 90 | - return result; | ||
| 91 | -} | ||
| 92 | - | ||
| 93 | - | ||
| 94 | - | ||
| 95 | at::Tensor& where_out( | 28 | at::Tensor& where_out( |
| 96 | const at::Tensor& condition, | 29 | const at::Tensor& condition, |
| 97 | const at::Tensor& self, | 30 | const at::Tensor& self, |
| @@ -124,5 +57,4 @@ at::Tensor where( | |||
| 124 | 57 | ||
| 125 | return result; | 58 | return result; |
| 126 | } | 59 | } |
| 127 | - | ||
| 128 | } | 60 | } |
| @@ -27,38 +27,6 @@ at::Tensor& zeros_out(at::IntArrayRef size, at::Tensor& out) | |||
| 27 | return out.zero_(); | 27 | return out.zero_(); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | - | ||
| 31 | -at::Tensor zeros(at::IntArrayRef size, | ||
| 32 | - c10::optional<at::ScalarType> dtype, | ||
| 33 | - c10::optional<at::Layout> layout, | ||
| 34 | - c10::optional<at::Device> device, | ||
| 35 | - c10::optional<bool> pin_memory) | ||
| 36 | -{ | ||
| 37 | - DO_COMPATIBILITY(aclnnInplaceZero, | ||
| 38 | - acl_op::zeros(size, dtype, layout, device, pin_memory)); | ||
| 39 | - at::TensorOptions option = option.dtype(dtype) | ||
| 40 | - .layout(layout) | ||
| 41 | - .device(device) | ||
| 42 | - .pinned_memory(pin_memory); | ||
| 43 | - at::Tensor result = npu_preparation::apply_tensor_without_format(size, option); | ||
| 44 | - return result.zero_(); | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -at::Tensor zeros( | ||
| 48 | - at::IntArrayRef size, | ||
| 49 | - c10::optional<at::DimnameList> names, | ||
| 50 | - c10::optional<at::ScalarType> dtype, | ||
| 51 | - c10::optional<at::Layout> layout, | ||
| 52 | - c10::optional<at::Device> device, | ||
| 53 | - c10::optional<bool> pin_memory) | ||
| 54 | -{ | ||
| 55 | - DO_COMPATIBILITY(aclnnInplaceZero, | ||
| 56 | - acl_op::zeros(size, names, dtype, layout, device, pin_memory)); | ||
| 57 | - return op_api::zeros(size, dtype, layout, device, pin_memory); | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - | ||
| 62 | at::Tensor zeros_symint( | 30 | at::Tensor zeros_symint( |
| 63 | c10::SymIntArrayRef size, | 31 | c10::SymIntArrayRef size, |
| 64 | c10::optional<at::ScalarType> dtype, | 32 | c10::optional<at::ScalarType> dtype, |
| @@ -94,5 +62,4 @@ at::Tensor zeros( | |||
| 94 | at::namedinference::propagate_names_if_nonempty(result, maybe_name); | 62 | at::namedinference::propagate_names_if_nonempty(result, maybe_name); |
| 95 | return result.zero_(); | 63 | return result.zero_(); |
| 96 | } | 64 | } |
| 97 | - | ||
| 98 | } | 65 | } |