class_docstr: Base class for TF1Saliency methods that use CoreSaliency methods.
  
  Alone, this class doesn't do anything.
class_docstr_tok: ["Base","class","for","TF1Saliency","methods","that","use","CoreSaliency","methods",".","Alone",",","this","class","does","n't","do","anything","."]
docstr: Validates the shapes of x and y tensors with respect to batch_size.
  
  Args:
    x_steps: Number of steps computed as part of the full method.
    batch_size: Maximum batch_size to split up the x_steps.
  
  Raises:
      ValueError: If x tensor shape is incompatible with batching parameters.
                  If y tensor shape is incompatible with batching parameters.
docstr_tok: ["Validates","the","shapes","of","x","and","y","tensors","with","respect","to","batch_size",".","Args",":","x_steps",":","Number","of","steps","computed","as","part","of","the","full","method",".","batch_size",":","Maximum","batch_size","to","split","up","the","x_steps",".","Raises",":","ValueError",":","If","x","tensor","shape","is","incompatible","with","batching","parameters",".","If","y","tensor","shape","is","incompatible","with","batching","parameters","."]
code: def validate_xy_tensor_shape(self, x_steps=1, batch_size=1):
      """Validates the shapes of x and y tensors with respect to batch_size.
  
      Args:
        x_steps: Number of steps computed as part of the full method.
        batch_size: Maximum batch_size to split up the x_steps.
  
      Raises:
          ValueError: If x tensor shape is incompatible with batching parameters.
                      If y tensor shape is incompatible with batching parameters.
      """
      batch_remainder = x_steps % batch_size
      if batch_remainder == 0:
          target_size = batch_size
      else:
          target_size = None
  
      # y should be shape (None,), (target_size), or () if target_size=1
      y_size = 1
      y_none_dim = False
      y_shape = self.y.get_shape().as_list()
      for shape in y_shape:
          if shape is None:
              y_none_dim = True
          else:
              y_size *= shape
      y_size_tuple = (y_size, y_none_dim)
      if y_size_tuple not in [(1, True), (target_size, False)]:
          expected = "[None]"
          if target_size is not None:
              expected += " or tensor with size {}".format(target_size)
          raise ValueError(
              Y_SHAPE_ERROR_MESSAGE.format(expected, y_shape)
          )
  
      # x.shape[0] should be shape None or target_size
      x_outer_size = self.x.get_shape().as_list()[0]
      if x_outer_size not in [None, target_size]:
          expected = "None"
          if target_size is not None:
              expected += " or {}".format(target_size)
          raise ValueError(
              X_SHAPE_ERROR_MESSAGE.format(expected, x_outer_size)
          )
  
file_path: saliency/saliency/tf1/base.py
imports: from .None import utils
  import numpy
label_desc: Use image node_id 2 for calling the TF1CoreSaliency obj's underlying member method code with example usage: obj.validate_xy_tensor_shape(x_steps, batch_size) without return types