@classmethod
def batch_size(cls, tensor):
    """ Return batch size (the length of the first dimension) of the input tensor

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

        Returns
        -------
        batch size : int or None
        """
    return tensor.get_shape().as_list()[0]
