We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
DetectoRS don't support pytorch version>=1.5
> 
  File "/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py", line 632, in forward
    x = res_layer(x)
  File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/container.py", line 117, in forward
    input = module(input)
  File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py", line 296, in forward
    out = _inner_forward(x)
  File "/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py", line 273, in _inner_forward
    out = self.conv2(out)
  File "/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib64/python3.6/site-packages/mmcv/ops/saconv.py", line 105, in forward
    out_s = super().conv2d_forward(x, weight)
AttributeError: 'super' object has no attribute 'conv2d_forward'

This is a PyTorch version problem, the PyTorch 1.5 has changed its internal API.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mmcv/ops/saconv.py`
Content:
```
1 import torch
2 import torch.nn as nn
3 import torch.nn.functional as F
4 
5 from mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init
6 from mmcv.ops.deform_conv import deform_conv2d
7 
8 
9 @CONV_LAYERS.register_module(name='SAC')
10 class SAConv2d(ConvAWS2d):
11     """SAC (Switchable Atrous Convolution)
12 
13     This is an implementation of SAC in DetectoRS
14     (https://arxiv.org/pdf/2006.02334.pdf).
15 
16     Args:
17         in_channels (int): Number of channels in the input image
18         out_channels (int): Number of channels produced by the convolution
19         kernel_size (int or tuple): Size of the convolving kernel
20         stride (int or tuple, optional): Stride of the convolution. Default: 1
21         padding (int or tuple, optional): Zero-padding added to both sides of
22             the input. Default: 0
23         padding_mode (string, optional): ``'zeros'``, ``'reflect'``,
24             ``'replicate'`` or ``'circular'``. Default: ``'zeros'``
25         dilation (int or tuple, optional): Spacing between kernel elements.
26             Default: 1
27         groups (int, optional): Number of blocked connections from input
28             channels to output channels. Default: 1
29         bias (bool, optional): If ``True``, adds a learnable bias to the
30             output. Default: ``True``
31         use_deform: If ``True``, replace convolution with deformable
32             convolution. Default: ``False``.
33     """
34 
35     def __init__(self,
36                  in_channels,
37                  out_channels,
38                  kernel_size,
39                  stride=1,
40                  padding=0,
41                  dilation=1,
42                  groups=1,
43                  bias=True,
44                  use_deform=False):
45         super().__init__(
46             in_channels,
47             out_channels,
48             kernel_size,
49             stride=stride,
50             padding=padding,
51             dilation=dilation,
52             groups=groups,
53             bias=bias)
54         self.use_deform = use_deform
55         self.switch = nn.Conv2d(
56             self.in_channels, 1, kernel_size=1, stride=stride, bias=True)
57         self.weight_diff = nn.Parameter(torch.Tensor(self.weight.size()))
58         self.pre_context = nn.Conv2d(
59             self.in_channels, self.in_channels, kernel_size=1, bias=True)
60         self.post_context = nn.Conv2d(
61             self.out_channels, self.out_channels, kernel_size=1, bias=True)
62         if self.use_deform:
63             self.offset_s = nn.Conv2d(
64                 self.in_channels,
65                 18,
66                 kernel_size=3,
67                 padding=1,
68                 stride=stride,
69                 bias=True)
70             self.offset_l = nn.Conv2d(
71                 self.in_channels,
72                 18,
73                 kernel_size=3,
74                 padding=1,
75                 stride=stride,
76                 bias=True)
77         self.init_weights()
78 
79     def init_weights(self):
80         constant_init(self.switch, 0, bias=1)
81         self.weight_diff.data.zero_()
82         constant_init(self.pre_context, 0)
83         constant_init(self.post_context, 0)
84         if self.use_deform:
85             constant_init(self.offset_s, 0)
86             constant_init(self.offset_l, 0)
87 
88     def forward(self, x):
89         # pre-context
90         avg_x = F.adaptive_avg_pool2d(x, output_size=1)
91         avg_x = self.pre_context(avg_x)
92         avg_x = avg_x.expand_as(x)
93         x = x + avg_x
94         # switch
95         avg_x = F.pad(x, pad=(2, 2, 2, 2), mode='reflect')
96         avg_x = F.avg_pool2d(avg_x, kernel_size=5, stride=1, padding=0)
97         switch = self.switch(avg_x)
98         # sac
99         weight = self._get_weight(self.weight)
100         if self.use_deform:
101             offset = self.offset_s(avg_x)
102             out_s = deform_conv2d(x, offset, weight, self.stride, self.padding,
103                                   self.dilation, self.groups, 1)
104         else:
105             out_s = super().conv2d_forward(x, weight)
106         ori_p = self.padding
107         ori_d = self.dilation
108         self.padding = tuple(3 * p for p in self.padding)
109         self.dilation = tuple(3 * d for d in self.dilation)
110         weight = weight + self.weight_diff
111         if self.use_deform:
112             offset = self.offset_l(avg_x)
113             out_l = deform_conv2d(x, offset, weight, self.stride, self.padding,
114                                   self.dilation, self.groups, 1)
115         else:
116             out_l = super().conv2d_forward(x, weight)
117         out = switch * out_s + (1 - switch) * out_l
118         self.padding = ori_p
119         self.dilation = ori_d
120         # post-context
121         avg_x = F.adaptive_avg_pool2d(out, output_size=1)
122         avg_x = self.post_context(avg_x)
123         avg_x = avg_x.expand_as(out)
124         out = out + avg_x
125         return out
126
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mmcv/ops/saconv.py b/mmcv/ops/saconv.py
--- a/mmcv/ops/saconv.py
+++ b/mmcv/ops/saconv.py
@@ -4,6 +4,7 @@
 
 from mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init
 from mmcv.ops.deform_conv import deform_conv2d
+from mmcv.utils import TORCH_VERSION
 
 
 @CONV_LAYERS.register_module(name='SAC')
@@ -102,7 +103,10 @@
             out_s = deform_conv2d(x, offset, weight, self.stride, self.padding,
                                   self.dilation, self.groups, 1)
         else:
-            out_s = super().conv2d_forward(x, weight)
+            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':
+                out_s = super().conv2d_forward(x, weight)
+            else:
+                out_s = super()._conv_forward(x, weight)
         ori_p = self.padding
         ori_d = self.dilation
         self.padding = tuple(3 * p for p in self.padding)
@@ -113,7 +117,10 @@
             out_l = deform_conv2d(x, offset, weight, self.stride, self.padding,
                                   self.dilation, self.groups, 1)
         else:
-            out_l = super().conv2d_forward(x, weight)
+            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':
+                out_l = super().conv2d_forward(x, weight)
+            else:
+                out_l = super()._conv_forward(x, weight)
         out = switch * out_s + (1 - switch) * out_l
         self.padding = ori_p
         self.dilation = ori_d

{"golden_diff": "diff --git a/mmcv/ops/saconv.py b/mmcv/ops/saconv.py\n--- a/mmcv/ops/saconv.py\n+++ b/mmcv/ops/saconv.py\n@@ -4,6 +4,7 @@\n \n from mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init\n from mmcv.ops.deform_conv import deform_conv2d\n+from mmcv.utils import TORCH_VERSION\n \n \n @CONV_LAYERS.register_module(name='SAC')\n@@ -102,7 +103,10 @@\n             out_s = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                   self.dilation, self.groups, 1)\n         else:\n-            out_s = super().conv2d_forward(x, weight)\n+            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':\n+                out_s = super().conv2d_forward(x, weight)\n+            else:\n+                out_s = super()._conv_forward(x, weight)\n         ori_p = self.padding\n         ori_d = self.dilation\n         self.padding = tuple(3 * p for p in self.padding)\n@@ -113,7 +117,10 @@\n             out_l = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                   self.dilation, self.groups, 1)\n         else:\n-            out_l = super().conv2d_forward(x, weight)\n+            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':\n+                out_l = super().conv2d_forward(x, weight)\n+            else:\n+                out_l = super()._conv_forward(x, weight)\n         out = switch * out_s + (1 - switch) * out_l\n         self.padding = ori_p\n         self.dilation = ori_d\n", "issue": "DetectoRS don't support pytorch version>=1.5\n> \r\n  File \"/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py\", line 632, in forward\r\n    x = res_layer(x)\r\n  File \"/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py\", line 722, in _call_impl\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/usr/local/lib64/python3.6/site-packages/torch/nn/modules/container.py\", line 117, in forward\r\n    input = module(input)\r\n  File \"/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py\", line 722, in _call_impl\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py\", line 296, in forward\r\n    out = _inner_forward(x)\r\n  File \"/jizhi/jizhi2/worker/trainer/mmdet/models/backbones/resnet.py\", line 273, in _inner_forward\r\n    out = self.conv2(out)\r\n  File \"/usr/local/lib64/python3.6/site-packages/torch/nn/modules/module.py\", line 722, in _call_impl\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/usr/local/lib64/python3.6/site-packages/mmcv/ops/saconv.py\", line 105, in forward\r\n    out_s = super().conv2d_forward(x, weight)\r\nAttributeError: 'super' object has no attribute 'conv2d_forward'\r\n\r\nThis is a PyTorch version problem, the PyTorch 1.5 has changed its internal API.\n", "before_files": [{"content": "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\nfrom mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init\nfrom mmcv.ops.deform_conv import deform_conv2d\n\n\n@CONV_LAYERS.register_module(name='SAC')\nclass SAConv2d(ConvAWS2d):\n    \"\"\"SAC (Switchable Atrous Convolution)\n\n    This is an implementation of SAC in DetectoRS\n    (https://arxiv.org/pdf/2006.02334.pdf).\n\n    Args:\n        in_channels (int): Number of channels in the input image\n        out_channels (int): Number of channels produced by the convolution\n        kernel_size (int or tuple): Size of the convolving kernel\n        stride (int or tuple, optional): Stride of the convolution. Default: 1\n        padding (int or tuple, optional): Zero-padding added to both sides of\n            the input. Default: 0\n        padding_mode (string, optional): ``'zeros'``, ``'reflect'``,\n            ``'replicate'`` or ``'circular'``. Default: ``'zeros'``\n        dilation (int or tuple, optional): Spacing between kernel elements.\n            Default: 1\n        groups (int, optional): Number of blocked connections from input\n            channels to output channels. Default: 1\n        bias (bool, optional): If ``True``, adds a learnable bias to the\n            output. Default: ``True``\n        use_deform: If ``True``, replace convolution with deformable\n            convolution. Default: ``False``.\n    \"\"\"\n\n    def __init__(self,\n                 in_channels,\n                 out_channels,\n                 kernel_size,\n                 stride=1,\n                 padding=0,\n                 dilation=1,\n                 groups=1,\n                 bias=True,\n                 use_deform=False):\n        super().__init__(\n            in_channels,\n            out_channels,\n            kernel_size,\n            stride=stride,\n            padding=padding,\n            dilation=dilation,\n            groups=groups,\n            bias=bias)\n        self.use_deform = use_deform\n        self.switch = nn.Conv2d(\n            self.in_channels, 1, kernel_size=1, stride=stride, bias=True)\n        self.weight_diff = nn.Parameter(torch.Tensor(self.weight.size()))\n        self.pre_context = nn.Conv2d(\n            self.in_channels, self.in_channels, kernel_size=1, bias=True)\n        self.post_context = nn.Conv2d(\n            self.out_channels, self.out_channels, kernel_size=1, bias=True)\n        if self.use_deform:\n            self.offset_s = nn.Conv2d(\n                self.in_channels,\n                18,\n                kernel_size=3,\n                padding=1,\n                stride=stride,\n                bias=True)\n            self.offset_l = nn.Conv2d(\n                self.in_channels,\n                18,\n                kernel_size=3,\n                padding=1,\n                stride=stride,\n                bias=True)\n        self.init_weights()\n\n    def init_weights(self):\n        constant_init(self.switch, 0, bias=1)\n        self.weight_diff.data.zero_()\n        constant_init(self.pre_context, 0)\n        constant_init(self.post_context, 0)\n        if self.use_deform:\n            constant_init(self.offset_s, 0)\n            constant_init(self.offset_l, 0)\n\n    def forward(self, x):\n        # pre-context\n        avg_x = F.adaptive_avg_pool2d(x, output_size=1)\n        avg_x = self.pre_context(avg_x)\n        avg_x = avg_x.expand_as(x)\n        x = x + avg_x\n        # switch\n        avg_x = F.pad(x, pad=(2, 2, 2, 2), mode='reflect')\n        avg_x = F.avg_pool2d(avg_x, kernel_size=5, stride=1, padding=0)\n        switch = self.switch(avg_x)\n        # sac\n        weight = self._get_weight(self.weight)\n        if self.use_deform:\n            offset = self.offset_s(avg_x)\n            out_s = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                  self.dilation, self.groups, 1)\n        else:\n            out_s = super().conv2d_forward(x, weight)\n        ori_p = self.padding\n        ori_d = self.dilation\n        self.padding = tuple(3 * p for p in self.padding)\n        self.dilation = tuple(3 * d for d in self.dilation)\n        weight = weight + self.weight_diff\n        if self.use_deform:\n            offset = self.offset_l(avg_x)\n            out_l = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                  self.dilation, self.groups, 1)\n        else:\n            out_l = super().conv2d_forward(x, weight)\n        out = switch * out_s + (1 - switch) * out_l\n        self.padding = ori_p\n        self.dilation = ori_d\n        # post-context\n        avg_x = F.adaptive_avg_pool2d(out, output_size=1)\n        avg_x = self.post_context(avg_x)\n        avg_x = avg_x.expand_as(out)\n        out = out + avg_x\n        return out\n", "path": "mmcv/ops/saconv.py"}], "after_files": [{"content": "import torch\nimport torch.nn as nn\nimport torch.nn.functional as F\n\nfrom mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init\nfrom mmcv.ops.deform_conv import deform_conv2d\nfrom mmcv.utils import TORCH_VERSION\n\n\n@CONV_LAYERS.register_module(name='SAC')\nclass SAConv2d(ConvAWS2d):\n    \"\"\"SAC (Switchable Atrous Convolution)\n\n    This is an implementation of SAC in DetectoRS\n    (https://arxiv.org/pdf/2006.02334.pdf).\n\n    Args:\n        in_channels (int): Number of channels in the input image\n        out_channels (int): Number of channels produced by the convolution\n        kernel_size (int or tuple): Size of the convolving kernel\n        stride (int or tuple, optional): Stride of the convolution. Default: 1\n        padding (int or tuple, optional): Zero-padding added to both sides of\n            the input. Default: 0\n        padding_mode (string, optional): ``'zeros'``, ``'reflect'``,\n            ``'replicate'`` or ``'circular'``. Default: ``'zeros'``\n        dilation (int or tuple, optional): Spacing between kernel elements.\n            Default: 1\n        groups (int, optional): Number of blocked connections from input\n            channels to output channels. Default: 1\n        bias (bool, optional): If ``True``, adds a learnable bias to the\n            output. Default: ``True``\n        use_deform: If ``True``, replace convolution with deformable\n            convolution. Default: ``False``.\n    \"\"\"\n\n    def __init__(self,\n                 in_channels,\n                 out_channels,\n                 kernel_size,\n                 stride=1,\n                 padding=0,\n                 dilation=1,\n                 groups=1,\n                 bias=True,\n                 use_deform=False):\n        super().__init__(\n            in_channels,\n            out_channels,\n            kernel_size,\n            stride=stride,\n            padding=padding,\n            dilation=dilation,\n            groups=groups,\n            bias=bias)\n        self.use_deform = use_deform\n        self.switch = nn.Conv2d(\n            self.in_channels, 1, kernel_size=1, stride=stride, bias=True)\n        self.weight_diff = nn.Parameter(torch.Tensor(self.weight.size()))\n        self.pre_context = nn.Conv2d(\n            self.in_channels, self.in_channels, kernel_size=1, bias=True)\n        self.post_context = nn.Conv2d(\n            self.out_channels, self.out_channels, kernel_size=1, bias=True)\n        if self.use_deform:\n            self.offset_s = nn.Conv2d(\n                self.in_channels,\n                18,\n                kernel_size=3,\n                padding=1,\n                stride=stride,\n                bias=True)\n            self.offset_l = nn.Conv2d(\n                self.in_channels,\n                18,\n                kernel_size=3,\n                padding=1,\n                stride=stride,\n                bias=True)\n        self.init_weights()\n\n    def init_weights(self):\n        constant_init(self.switch, 0, bias=1)\n        self.weight_diff.data.zero_()\n        constant_init(self.pre_context, 0)\n        constant_init(self.post_context, 0)\n        if self.use_deform:\n            constant_init(self.offset_s, 0)\n            constant_init(self.offset_l, 0)\n\n    def forward(self, x):\n        # pre-context\n        avg_x = F.adaptive_avg_pool2d(x, output_size=1)\n        avg_x = self.pre_context(avg_x)\n        avg_x = avg_x.expand_as(x)\n        x = x + avg_x\n        # switch\n        avg_x = F.pad(x, pad=(2, 2, 2, 2), mode='reflect')\n        avg_x = F.avg_pool2d(avg_x, kernel_size=5, stride=1, padding=0)\n        switch = self.switch(avg_x)\n        # sac\n        weight = self._get_weight(self.weight)\n        if self.use_deform:\n            offset = self.offset_s(avg_x)\n            out_s = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                  self.dilation, self.groups, 1)\n        else:\n            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':\n                out_s = super().conv2d_forward(x, weight)\n            else:\n                out_s = super()._conv_forward(x, weight)\n        ori_p = self.padding\n        ori_d = self.dilation\n        self.padding = tuple(3 * p for p in self.padding)\n        self.dilation = tuple(3 * d for d in self.dilation)\n        weight = weight + self.weight_diff\n        if self.use_deform:\n            offset = self.offset_l(avg_x)\n            out_l = deform_conv2d(x, offset, weight, self.stride, self.padding,\n                                  self.dilation, self.groups, 1)\n        else:\n            if TORCH_VERSION < '1.5.0' or TORCH_VERSION == 'parrots':\n                out_l = super().conv2d_forward(x, weight)\n            else:\n                out_l = super()._conv_forward(x, weight)\n        out = switch * out_s + (1 - switch) * out_l\n        self.padding = ori_p\n        self.dilation = ori_d\n        # post-context\n        avg_x = F.adaptive_avg_pool2d(out, output_size=1)\n        avg_x = self.post_context(avg_x)\n        avg_x = avg_x.expand_as(out)\n        out = out + avg_x\n        return out\n", "path": "mmcv/ops/saconv.py"}]}