def num_symbolic(val):
    """
    Return the number of symbols in val
    """
    if is_symbolic(val):
        return 1
    elif isinstance(val, np.ndarray) and val.dtype.type != _OBJECT_DTYPE:
        return 0
    elif hasattr(val, "__iter__"):
        return sum(any_symbolic(i) for i in val)
    return 0

    Return the number of symbols in val
    
coremltools/converters/mil/mil/types/symbolic.py