def get_number_of_outputs(output_data):
    """Get the number of output variables for a given output array."""
    if not hasattr(output_data, 'shape'):
        raise AttributeError(
            'Output data types must have attribute "shape".'
        )

    if len(output_data.shape) == 1:
        return 1

    return output_data.shape[1]