def prediction_tensors_to_boxes(detection_scores, y_indices, x_indices, channel_indices, height_width_predictions, offset_predictions):
    'Converts CenterNet class-center, offset and size predictions to boxes.\n\n  Args:\n    detection_scores: A [batch, num_boxes] float32 tensor with detection\n      scores in range [0, 1].\n    y_indices: A [batch, num_boxes] int32 tensor with y indices corresponding to\n      object center locations (expressed in output coordinate frame).\n    x_indices: A [batch, num_boxes] int32 tensor with x indices corresponding to\n      object center locations (expressed in output coordinate frame).\n    channel_indices: A [batch, num_boxes] int32 tensor with channel indices\n      corresponding to object classes.\n    height_width_predictions: A float tensor of shape [batch_size, height,\n      width, 2] representing the height and width of a box centered at each\n      pixel.\n    offset_predictions: A float tensor of shape [batch_size, height, width, 2]\n      representing the y and x offsets of a box centered at each pixel. This\n      helps reduce the error from downsampling.\n\n  Returns:\n    detection_boxes: A tensor of shape [batch_size, num_boxes, 4] holding the\n      the raw bounding box coordinates of boxes.\n    detection_classes: An integer tensor of shape [batch_size, num_boxes]\n      indicating the predicted class for each box.\n    detection_scores: A float tensor of shape [batch_size, num_boxes] indicating\n      the score for each box.\n    num_detections: An integer tensor of shape [batch_size,] indicating the\n      number of boxes detected for each sample in the batch.\n\n  '
    (_, _, width, _) = _get_shape(height_width_predictions, 4)
    peak_spatial_indices = flattened_indices_from_row_col_indices(y_indices, x_indices, width)
    y_indices = _to_float32(y_indices)
    x_indices = _to_float32(x_indices)
    height_width_flat = _flatten_spatial_dimensions(height_width_predictions)
    offsets_flat = _flatten_spatial_dimensions(offset_predictions)
    height_width = tf.gather(height_width_flat, peak_spatial_indices, batch_dims=1)
    height_width = tf.maximum(height_width, 0)
    offsets = tf.gather(offsets_flat, peak_spatial_indices, batch_dims=1)
    (heights, widths) = tf.unstack(height_width, axis=2)
    (y_offsets, x_offsets) = tf.unstack(offsets, axis=2)
    detection_classes = channel_indices
    num_detections = tf.reduce_sum(tf.to_int32((detection_scores > 0)), axis=1)
    boxes = tf.stack([((y_indices + y_offsets) - (heights / 2.0)), ((x_indices + x_offsets) - (widths / 2.0)), ((y_indices + y_offsets) + (heights / 2.0)), ((x_indices + x_offsets) + (widths / 2.0))], axis=2)
    return (boxes, detection_classes, detection_scores, num_detections)
Converts CenterNet class-center, offset and size predictions to boxes.

Args:
  detection_scores: A [batch, num_boxes] float32 tensor with detection
    scores in range [0, 1].
  y_indices: A [batch, num_boxes] int32 tensor with y indices corresponding to
    object center locations (expressed in output coordinate frame).
  x_indices: A [batch, num_boxes] int32 tensor with x indices corresponding to
    object center locations (expressed in output coordinate frame).
  channel_indices: A [batch, num_boxes] int32 tensor with channel indices
    corresponding to object classes.
  height_width_predictions: A float tensor of shape [batch_size, height,
    width, 2] representing the height and width of a box centered at each
    pixel.
  offset_predictions: A float tensor of shape [batch_size, height, width, 2]
    representing the y and x offsets of a box centered at each pixel. This
    helps reduce the error from downsampling.

Returns:
  detection_boxes: A tensor of shape [batch_size, num_boxes, 4] holding the
    the raw bounding box coordinates of boxes.
  detection_classes: An integer tensor of shape [batch_size, num_boxes]
    indicating the predicted class for each box.
  detection_scores: A float tensor of shape [batch_size, num_boxes] indicating
    the score for each box.
  num_detections: An integer tensor of shape [batch_size,] indicating the
    number of boxes detected for each sample in the batch.
def prediction_tensors_to_boxes(detection_scores, y_indices, x_indices, channel_indices, height_width_predictions, offset_predictions):
    'Converts CenterNet class-center, offset and size predictions to boxes.\n\n  Args:\n    detection_scores: A [batch, num_boxes] float32 tensor with detection\n      scores in range [0, 1].\n    y_indices: A [batch, num_boxes] int32 tensor with y indices corresponding to\n      object center locations (expressed in output coordinate frame).\n    x_indices: A [batch, num_boxes] int32 tensor with x indices corresponding to\n      object center locations (expressed in output coordinate frame).\n    channel_indices: A [batch, num_boxes] int32 tensor with channel indices\n      corresponding to object classes.\n    height_width_predictions: A float tensor of shape [batch_size, height,\n      width, 2] representing the height and width of a box centered at each\n      pixel.\n    offset_predictions: A float tensor of shape [batch_size, height, width, 2]\n      representing the y and x offsets of a box centered at each pixel. This\n      helps reduce the error from downsampling.\n\n  Returns:\n    detection_boxes: A tensor of shape [batch_size, num_boxes, 4] holding the\n      the raw bounding box coordinates of boxes.\n    detection_classes: An integer tensor of shape [batch_size, num_boxes]\n      indicating the predicted class for each box.\n    detection_scores: A float tensor of shape [batch_size, num_boxes] indicating\n      the score for each box.\n    num_detections: An integer tensor of shape [batch_size,] indicating the\n      number of boxes detected for each sample in the batch.\n\n  '
    (_, _, width, _) = _get_shape(height_width_predictions, 4)
    peak_spatial_indices = flattened_indices_from_row_col_indices(y_indices, x_indices, width)
    y_indices = _to_float32(y_indices)
    x_indices = _to_float32(x_indices)
    height_width_flat = _flatten_spatial_dimensions(height_width_predictions)
    offsets_flat = _flatten_spatial_dimensions(offset_predictions)
    height_width = tf.gather(height_width_flat, peak_spatial_indices, batch_dims=1)
    height_width = tf.maximum(height_width, 0)
    offsets = tf.gather(offsets_flat, peak_spatial_indices, batch_dims=1)
    (heights, widths) = tf.unstack(height_width, axis=2)
    (y_offsets, x_offsets) = tf.unstack(offsets, axis=2)
    detection_classes = channel_indices
    num_detections = tf.reduce_sum(tf.to_int32((detection_scores > 0)), axis=1)
    boxes = tf.stack([((y_indices + y_offsets) - (heights / 2.0)), ((x_indices + x_offsets) - (widths / 2.0)), ((y_indices + y_offsets) + (heights / 2.0)), ((x_indices + x_offsets) + (widths / 2.0))], axis=2)
    return (boxes, detection_classes, detection_scores, num_detections)