def SHAPE_FILTER()

in Synthesis_incorporation/value_search/operation_filtering.py [0:0]


def SHAPE_FILTER(arg_value):
    """Only keeps int sequences representing tensor shapes."""
    return (
        arg_value.is_sequence
        and arg_value.elem_type is int
        and 0 < len(arg_value.value) <= limits.MAX_NUM_DIMENSIONS
        and arg_value.min() > 0
        and arg_value.max() <= limits.MAX_DIMENSION_LENGTH
        and arg_value.reduce_prod() <= limits.MAX_TENSOR_ELEMENTS
    )