0a1,15
> # Copyright 2021 Huawei Technologies Co., Ltd
> #
> # Licensed under the Apache License, Version 2.0 (the "License");
> # you may not use this file except in compliance with the License.
> # You may obtain a copy of the License at
> #
> # http://www.apache.org/licenses/LICENSE-2.0
> #
> # Unless required by applicable law or agreed to in writing, software
> # distributed under the License is distributed on an "AS IS" BASIS,
> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> # See the License for the specific language governing permissions and
> # limitations under the License.
>
>
25d39
< offset,
26a41
> offset,
35c50
< 'MMCVDeformConv2d',
> 'DeformableConv2D',
37d51
< offset,
39,41c53,56
< stride_i=stride,
< padding_i=padding,
< dilation_i=dilation,
> offset,
> strides_i=stride,
> pads_i=padding,
> dilations_i=dilation,
43c58
< deform_groups_i=deform_groups,
> deformable_groups_i=deform_groups,
44a60
> data_format_s="NCHW",
50d65
< offset,
51a67
> offset,
80a97,98
> if torch.onnx.is_in_onnx_export():
> return torch.rand(output.shape)
296c314,321
< return deform_conv2d(x, offset, self.weight, self.stride, self.padding,
> if torch.onnx.is_in_onnx_export():
> offset_y = offset.reshape(1, -1, 2, offset.shape[2].numpy(), offset.shape[3].numpy())[:, :, 0, ...].reshape(
> 1, offset.shape[1].numpy() // 2, offset.shape[2].numpy(), offset.shape[3].numpy())
> offset_x = offset.reshape(1, -1, 2, offset.shape[2].numpy(), offset.shape[3].numpy())[:, :, 1, ...].reshape(
> 1, offset.shape[1].numpy() // 2, offset.shape[2].numpy(), offset.shape[3].numpy())
> mask = torch.ones(offset.shape[0].numpy(), offset.shape[1].numpy() // 2, offset.shape[2].numpy(), offset.shape[3].numpy())
> offset = torch.cat((offset_x, offset_y, mask), 1)
> return deform_conv2d(x, self.weight, offset, self.stride, self.padding,