def _get_channel_rank(image_format):
  """Returns the rank of the channel dimension."""
  if image_format not in ['HWCN', 'NHWC', 'NCHW']:
    raise ValueError('Unimplemented images format: {:s}.'.format(image_format))
  return image_format.find('C')