code: def _max_pool2d_backward(
      self,
      indices,
      kernel_size,
      padding=None,
      stride=None,
      dilation=1,
      ceil_mode=False,
      output_size=None,
  ):
      """Implements the backwards for a `max_pool2d` call."""
      # Setup padding
      if padding is None:
          padding = 0
      if isinstance(padding, int):
          padding = padding, padding
      assert isinstance(
          padding, tuple
      ), "padding must be a int, tuple, or None"
      p0, p1 = padding
  
      # Setup stride
      if stride is None:
          stride = kernel_size
      if isinstance(stride, int):
          stride = stride, stride
      assert isinstance(
          stride, tuple
      ), "stride must be a int, tuple, or None"
      s0, s1 = stride
  
      # Setup dilation
      if isinstance(stride, int):
          dilation = dilation, dilation
      assert isinstance(
          dilation, tuple
      ), "dilation must be a int, tuple, or None"
      d0, d1 = dilation
  
      # Setup kernel_size
      if isinstance(kernel_size, int):
          kernel_size = kernel_size, kernel_size
      assert isinstance(
          padding, tuple
      ), "padding must be a int or tuple"
      k0, k1 = kernel_size
  
      assert (
          self.dim() == 4
      ), "Input to _max_pool2d_backward must have 4 dimensions"
      assert (
          indices.dim() == 6
      ), "Indices input for _max_pool2d_backward must have 6 dimensions"
  
      # Computes one-hot gradient blocks from each output variable that
      # has non-zero value corresponding to the argmax of the corresponding
      # block of the max_pool2d input.
      kernels = self.view(self.size() + (1, 1)) * indices
  
      # Use minimal size if output_size is not specified.
      if output_size is None:
          output_size = (
              self.size(0),
              self.size(1),
              s0 * self.size(2) - 2 * p0,
              s1 * self.size(3) - 2 * p1,
          )
  
      # Account for input padding
      result_size = list(output_size)
      result_size[-2] += 2 * p0
      result_size[-1] += 2 * p1
  
      # Account for input padding implied by ceil_mode
      if ceil_mode:
          c0 = self.size(-1) * s1 + (k1 - 1) * d1 - output_size[-1]
          c1 = self.size(-2) * s0 + (k0 - 1) * d0 - output_size[-2]
          result_size[-2] += c0
          result_size[-1] += c1
  
      # Sum the one-hot gradient blocks at corresponding index locations.
      result = self.new(torch.zeros(result_size, device=kernels.device))
      for i in range(self.size(2)):
          for j in range(self.size(3)):
              left_ind = s0 * i
              top_ind = s1 * j
  
              result[
                  :,
                  :,
                  left_ind : left_ind + k0 * d0 : d0,
                  top_ind : top_ind + k1 * d1 : d1,
              ] += kernels[:, :, i, j]
  
      # Remove input padding
      if ceil_mode:
          result = result[
              :, :, : result.size(2) - c0, : result.size(3) - c1
          ]
      result = result[
          :, :, p0 : result.size(2) - p0, p1 : result.size(3) - p1
      ]
  
      return result
  
file_path: CrypTen/crypten/common/functions/pooling.py
imports: import math
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: _max_pool2d_backward(indices, kernel_size, padding, stride, dilation, ceil_mode, output_size) and returns: result