def get_num_channels(tensor, data_format='channels_last'):
    ' Return number of channels in the input tensor.\n\n    Parameters\n    ----------\n    tensor : tf.Tensor\n\n    Returns\n    -------\n    shape : tuple of ints\n    '
    shape = tensor.get_shape().as_list()
    axis = get_channels_axis(data_format)
    return shape[axis]
Return number of channels in the input tensor.

Parameters
----------
tensor : tf.Tensor

Returns
-------
shape : tuple of ints
def get_num_channels(tensor, data_format='channels_last'):
    ' Return number of channels in the input tensor.\n\n    Parameters\n    ----------\n    tensor : tf.Tensor\n\n    Returns\n    -------\n    shape : tuple of ints\n    '
    shape = tensor.get_shape().as_list()
    axis = get_channels_axis(data_format)
    return shape[axis]