class_docstr: See :func:`deform_conv2d`.
class_docstr_tok: ["See",":","func",":","`","deform_conv2d","`","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      kernel_size: int,
      stride: int = 1,
      padding: int = 0,
      dilation: int = 1,
      groups: int = 1,
      bias: bool = True,
  ):
      super().__init__()
      _log_api_usage_once(self)
  
      if in_channels % groups != 0:
          raise ValueError("in_channels must be divisible by groups")
      if out_channels % groups != 0:
          raise ValueError("out_channels must be divisible by groups")
  
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.kernel_size = _pair(kernel_size)
      self.stride = _pair(stride)
      self.padding = _pair(padding)
      self.dilation = _pair(dilation)
      self.groups = groups
  
      self.weight = Parameter(
          torch.empty(
              out_channels,
              in_channels // groups,
              self.kernel_size[0],
              self.kernel_size[1],
          )
      )
  
      if bias:
          self.bias = Parameter(torch.empty(out_channels))
      else:
          self.register_parameter("bias", None)
  
      self.reset_parameters()
  
file_path: vision/torchvision/ops/deform_conv.py
imports: import math
  from typing import Optional, Tuple
  import torch
  from torch import nn, Tensor
  from torch.nn import init
  from torch.nn.modules.utils import _pair
  from torch.nn.parameter import Parameter
  from torchvision.extension import _assert_has_ops
  from ..utils import _log_api_usage_once
label_desc: Use image node_id 1 to create a new DeformConv2d object from inherited base classes: nn with example: obj = DeformConv2d(in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias)