def TENSOR_PRIMITIVE_SAME_TYPES_APPLY_FILTER()

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


def TENSOR_PRIMITIVE_SAME_TYPES_APPLY_FILTER(arg_values):
    x, y = arg_values
    if x.is_tensor:
        if y.is_tensor:
            return x.dtype == y.dtype
        elif y.is_primitive:
            if x.has_float_dtype() and y.type is float:
                return True
            elif x.has_int_dtype() and y.type is int:
                return True
            else:
                return False
    elif x.is_primitive:
        if y.is_primitive:
            return x.type == y.type
        elif y.is_tensor:
            if x.type is float and x.has_float_dtype():
                return True
            elif x.type is int and x.has_int_dtype():
                return True
            else:
                return False
    return False