class_docstr: Implements the functionality for albating the image, and retaining only a column
class_docstr_tok: ["Implements","the","functionality","for","albating","the","image",",","and","retaining","only","a","column"]
docstr: Ablates the image only retaining a column starting at "pos" of width "self.ablation_size"
  
  :param x: input image.
  :param column_pos: location to start the retained column. NB, if row_ablation_mode is true then this will
                     be used to act on the rows through transposing the image.
  :param row_pos: Unused.
  :return: ablated image keeping only a column.
docstr_tok: ["Ablates","the","image","only","retaining","a","column","starting","at","``","pos","''","of","width","``","self.ablation_size","''",":","param","x",":","input","image",".",":","param","column_pos",":","location","to","start","the","retained","column",".","NB",",","if","row_ablation_mode","is","true","then","this","will","be","used","to","act","on","the","rows","through","transposing","the","image",".",":","param","row_pos",":","Unused",".",":","return",":","ablated","image","keeping","only","a","column","."]
code: def ablate(
      self,
      x: np.ndarray,
      column_pos: int,
      row_pos: Optional[int] = None,
  ) -> np.ndarray:
      """
      Ablates the image only retaining a column starting at "pos" of width "self.ablation_size"
  
      :param x: input image.
      :param column_pos: location to start the retained column. NB, if row_ablation_mode is true then this will
                         be used to act on the rows through transposing the image.
      :param row_pos: Unused.
      :return: ablated image keeping only a column.
      """
      if self.row_ablation_mode:
          x = np.transpose(x, (0, 1, 3, 2))
  
      k = self.ablation_size
      num_of_image_columns = x.shape[-1]
  
      if column_pos + k > num_of_image_columns:
          start_of_ablation = column_pos + k - num_of_image_columns
          x[:, :, :, start_of_ablation:column_pos] = 0.0
      else:
          x[:, :, :, :column_pos] = 0.0
          x[:, :, :, column_pos + k :] = 0.0
  
      if self.row_ablation_mode:
          x = np.transpose(x, (0, 1, 3, 2))
  
      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 4 for calling the ColumnAblator obj's underlying member method code with example usage: obj.ablate(x, column_pos, row_pos) and returns: x