From 00e92ab632953fb6cbc6ef4b9fb3aba3cf0bf3b5 Mon Sep 17 00:00:00 2001 From: shun001 <56623740+shun001@users.noreply.github.com> Date: Tue, 24 Oct 2023 11:43:19 +0800 Subject: [PATCH] [Fix] Fix deform_conv.py for torch_npu v2.1 (#2967) --- mmcv/ops/deform_conv.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmcv/ops/deform_conv.py b/mmcv/ops/deform_conv.py index 8251bc7328..c6cbba6779 100644 --- a/mmcv/ops/deform_conv.py +++ b/mmcv/ops/deform_conv.py @@ -51,10 +51,11 @@ def symbolic(g, @staticmethod def _npu_backward(ctx, grad_output): + import torch_npu input_tensor, weight, offset_out, offset_all, sort_index_for_npu_bp = \ ctx.saved_tensors grad_input, grad_weight, grad_offset_all, grad_bias = \ - torch.npu_deformable_conv2dbk( + torch_npu.npu_deformable_conv2dbk( input_tensor, grad_output, offset_out, weight, offset_all, kernel_size=[weight.shape[3], weight.shape[2]], stride=[1, 1, ctx.stride[0], ctx.stride[1]],