class_docstr: Implements the functionality for albating the image, and retaining only a block
class_docstr_tok: ["Implements","the","functionality","for","albating","the","image",",","and","retaining","only","a","block"]
docstr: Ablates the image only retaining a block starting at (row_pos, column_pos) of height/width "self.ablation_size"
  
  :param x: input data
  :param row_pos: Specifies the row index where to retain the image block.
  :param column_pos: Specifies the column index where to retain the image block.
  :return: Data ablated at all locations aside from the specified block.
docstr_tok: ["Ablates","the","image","only","retaining","a","block","starting","at","(","row_pos",",","column_pos",")","of","height\/width","``","self.ablation_size","''",":","param","x",":","input","data",":","param","row_pos",":","Specifies","the","row","index","where","to","retain","the","image","block",".",":","param","column_pos",":","Specifies","the","column","index","where","to","retain","the","image","block",".",":","return",":","Data","ablated","at","all","locations","aside","from","the","specified","block","."]
code: def ablate(
      self, x: np.ndarray, column_pos: int, row_pos: int
  ) -> np.ndarray:
      """
      Ablates the image only retaining a block starting at (row_pos, column_pos) of height/width "self.ablation_size"
  
      :param x: input data
      :param row_pos: Specifies the row index where to retain the image block.
      :param column_pos: Specifies the column index where to retain the image block.
      :return: Data ablated at all locations aside from the specified block.
      """
      k = self.ablation_size
      # Column ablations
      if column_pos + k > x.shape[-1]:
          x[:, :, :, (column_pos + k) % x.shape[-1] : column_pos] = 0.0
      else:
          x[:, :, :, :column_pos] = 0.0
          x[:, :, :, column_pos + k :] = 0.0
  
      # Row ablations
      if row_pos + k > x.shape[-2]:
          x[:, :, (row_pos + k) % x.shape[-2] : row_pos, :] = 0.0
      else:
          x[:, :, :row_pos, :] = 0.0
          x[:, :, row_pos + k :, :] = 0.0
      return x
  
file_path: adversarial-robustness-toolbox/art/estimators/certification/derandomized_smoothing/ablators/tensorflow.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from typing import Optional, Union, Tuple, TYPE_CHECKING
  import random
  import numpy
  from art.estimators.certification.derandomized_smoothing.ablators.ablate import BaseAblator
label_desc: Use image node_id 5 for calling the BlockAblator obj's underlying member method code with example usage: obj.ablate(x, column_pos, row_pos) and returns: x