def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal):
    'Shifts the bbox coordinates by pixels.\n\n  Args:\n    bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n      of type float that represents the normalized coordinates between 0 and 1.\n    image_height: Int, height of the image.\n    image_width: Int, width of the image.\n    pixels: An int. How many pixels to shift the bbox.\n    shift_horizontal: Boolean. If true then shift in X dimension else shift in\n      Y dimension.\n\n  Returns:\n    A tensor of the same shape as bbox, but now with the shifted coordinates.\n  '
    pixels = tf.to_int32(pixels)
    min_y = tf.to_int32((tf.to_float(image_height) * bbox[0]))
    min_x = tf.to_int32((tf.to_float(image_width) * bbox[1]))
    max_y = tf.to_int32((tf.to_float(image_height) * bbox[2]))
    max_x = tf.to_int32((tf.to_float(image_width) * bbox[3]))
    if shift_horizontal:
        min_x = tf.maximum(0, (min_x - pixels))
        max_x = tf.minimum(image_width, (max_x - pixels))
    else:
        min_y = tf.maximum(0, (min_y - pixels))
        max_y = tf.minimum(image_height, (max_y - pixels))
    min_y = (tf.to_float(min_y) / tf.to_float(image_height))
    min_x = (tf.to_float(min_x) / tf.to_float(image_width))
    max_y = (tf.to_float(max_y) / tf.to_float(image_height))
    max_x = (tf.to_float(max_x) / tf.to_float(image_width))
    (min_y, min_x, max_y, max_x) = _clip_bbox(min_y, min_x, max_y, max_x)
    (min_y, min_x, max_y, max_x) = _check_bbox_area(min_y, min_x, max_y, max_x)
    return tf.stack([min_y, min_x, max_y, max_x])
Shifts the bbox coordinates by pixels.

Args:
  bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)
    of type float that represents the normalized coordinates between 0 and 1.
  image_height: Int, height of the image.
  image_width: Int, width of the image.
  pixels: An int. How many pixels to shift the bbox.
  shift_horizontal: Boolean. If true then shift in X dimension else shift in
    Y dimension.

Returns:
  A tensor of the same shape as bbox, but now with the shifted coordinates.
def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal):
    'Shifts the bbox coordinates by pixels.\n\n  Args:\n    bbox: 1D Tensor that has 4 elements (min_y, min_x, max_y, max_x)\n      of type float that represents the normalized coordinates between 0 and 1.\n    image_height: Int, height of the image.\n    image_width: Int, width of the image.\n    pixels: An int. How many pixels to shift the bbox.\n    shift_horizontal: Boolean. If true then shift in X dimension else shift in\n      Y dimension.\n\n  Returns:\n    A tensor of the same shape as bbox, but now with the shifted coordinates.\n  '
    pixels = tf.to_int32(pixels)
    min_y = tf.to_int32((tf.to_float(image_height) * bbox[0]))
    min_x = tf.to_int32((tf.to_float(image_width) * bbox[1]))
    max_y = tf.to_int32((tf.to_float(image_height) * bbox[2]))
    max_x = tf.to_int32((tf.to_float(image_width) * bbox[3]))
    if shift_horizontal:
        min_x = tf.maximum(0, (min_x - pixels))
        max_x = tf.minimum(image_width, (max_x - pixels))
    else:
        min_y = tf.maximum(0, (min_y - pixels))
        max_y = tf.minimum(image_height, (max_y - pixels))
    min_y = (tf.to_float(min_y) / tf.to_float(image_height))
    min_x = (tf.to_float(min_x) / tf.to_float(image_width))
    max_y = (tf.to_float(max_y) / tf.to_float(image_height))
    max_x = (tf.to_float(max_x) / tf.to_float(image_width))
    (min_y, min_x, max_y, max_x) = _clip_bbox(min_y, min_x, max_y, max_x)
    (min_y, min_x, max_y, max_x) = _check_bbox_area(min_y, min_x, max_y, max_x)
    return tf.stack([min_y, min_x, max_y, max_x])