已合并
修改了upsample_binlinear_2d中scales_h_attr、scales_w_attr传入的默认值 #4144
jjt_3创建于 1月29日
修改了upsample_binlinear_2d中scales_h_attr、scales_w_attr传入的默认值 #4144
已合并
共 1 个文件变更+4-6
| @@ -31,9 +31,8 @@ at::Tensor& upsample_bilinear2d_out(const at::Tensor& self_ex, at::IntArrayRef o | |||
| 31 | OPS_ERROR(ErrCode::TYPE)); | 31 | OPS_ERROR(ErrCode::TYPE)); |
| 32 | auto outputSize = op_infer::upsample_bilinear2d_npu_output_size(self, output_size); | 32 | auto outputSize = op_infer::upsample_bilinear2d_npu_output_size(self, output_size); |
| 33 | npu_preparation::check_tensor({self}, result, self, outputSize); | 33 | npu_preparation::check_tensor({self}, result, self, outputSize); |
| 34 | - static double default_scale = (c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend950) ? 0 : 1; | 34 | + double scales_h_attr = scales_h.value_or(0); |
| 35 | - double scales_h_attr = scales_h.value_or(default_scale); | 35 | + double scales_w_attr = scales_w.value_or(0); |
| 36 | - double scales_w_attr = scales_w.value_or(default_scale); | ||
| 37 | 36 | ||
| 38 | EXEC_NPU_CMD(aclnnUpsampleBilinear2d, self, output_size, align_corners, scales_h_attr, scales_w_attr, result); | 37 | EXEC_NPU_CMD(aclnnUpsampleBilinear2d, self, output_size, align_corners, scales_h_attr, scales_w_attr, result); |
| 39 | return result; | 38 | return result; |
| @@ -48,9 +47,8 @@ at::Tensor upsample_bilinear2d(const at::Tensor& self_ex, at::IntArrayRef output | |||
| 48 | at::Tensor self = self_ex; | 47 | at::Tensor self = self_ex; |
| 49 | TORCH_CHECK(self.scalar_type() != at::ScalarType::Double, "upsample_binlinear_2d not support torch.fp64 dtypes", | 48 | TORCH_CHECK(self.scalar_type() != at::ScalarType::Double, "upsample_binlinear_2d not support torch.fp64 dtypes", |
| 50 | OPS_ERROR(ErrCode::TYPE)); | 49 | OPS_ERROR(ErrCode::TYPE)); |
| 51 | - static double default_scale = (c10_npu::GetSocVersion() >= c10_npu::SocVersion::Ascend950) ? 0 : 1; | 50 | + double scales_h_attr = scales_h.value_or(0); |
| 52 | - double scales_h_attr = scales_h.value_or(default_scale); | 51 | + double scales_w_attr = scales_w.value_or(0); |
| 53 | - double scales_w_attr = scales_w.value_or(default_scale); | ||
| 54 | auto outputSize = op_infer::upsample_bilinear2d_npu_output_size(self, output_size); | 52 | auto outputSize = op_infer::upsample_bilinear2d_npu_output_size(self, output_size); |
| 55 | at::Tensor result = npu_preparation::apply_tensor_without_format(outputSize, self.options()); | 53 | at::Tensor result = npu_preparation::apply_tensor_without_format(outputSize, self.options()); |
| 56 | 54 | ||