Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hust17yixuan committed Dec 9, 2024
1 parent e39eb62 commit f299001
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mmcv/ops/deform_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,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[2], weight.shape[3]],
stride=[1, 1, ctx.stride[0], ctx.stride[1]],
Expand Down
3 changes: 2 additions & 1 deletion mmcv/ops/modulated_deform_conv.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ def _npu_forward(ctx, input_tensor, offset, mask, weight, bias):
def _npu_backward(ctx, grad_output):
input_tensor, weight, offset_out, offset_all, sort_index_bp = \
ctx.saved_tensors
import torch_npu
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[2], weight.shape[3]],
stride=[1, 1, ctx.stride[0], ctx.stride[1]],
Expand Down

0 comments on commit f299001

Please sign in to comment.