Пример #1
0
def test_default_version_IR_V11_seperate_paths():
    core = Core()
    xml_path = "./serialized_function.xml"
    bin_path = "./serialized_function.bin"
    shape = [100, 100, 2]
    parameter_a = ov.parameter(shape, dtype=np.float32, name="A")
    parameter_b = ov.parameter(shape, dtype=np.float32, name="B")
    parameter_c = ov.parameter(shape, dtype=np.float32, name="C")
    parameter_d = ov.parameter(shape, dtype=np.float32, name="D")
    model = ov.floor(
        ov.minimum(ov.abs(parameter_a), ov.multiply(parameter_b, parameter_c)))
    func = Model(model, [parameter_a, parameter_b, parameter_c], "Model")
    pass_manager = Manager()
    pass_manager.register_pass("Serialize",
                               xml_path=xml_path,
                               bin_path=bin_path,
                               version="IR_V11")
    pass_manager.run_passes(func)

    res_func = core.read_model(model=xml_path, weights=bin_path)

    assert func.get_parameters() == res_func.get_parameters()
    assert func.get_ordered_ops() == res_func.get_ordered_ops()

    os.remove(xml_path)
    os.remove(bin_path)
Пример #2
0
def binary_op(op_str, a, b):

    if op_str == "+":
        return a + b
    elif op_str == "Add":
        return ov.add(a, b)
    elif op_str == "-":
        return a - b
    elif op_str == "Sub":
        return ov.subtract(a, b)
    elif op_str == "*":
        return a * b
    elif op_str == "Mul":
        return ov.multiply(a, b)
    elif op_str == "/":
        return a / b
    elif op_str == "Div":
        return ov.divide(a, b)
    elif op_str == "Equal":
        return ov.equal(a, b)
    elif op_str == "Greater":
        return ov.greater(a, b)
    elif op_str == "GreaterEq":
        return ov.greater_equal(a, b)
    elif op_str == "Less":
        return ov.less(a, b)
    elif op_str == "LessEq":
        return ov.less_equal(a, b)
    elif op_str == "Maximum":
        return ov.maximum(a, b)
    elif op_str == "Minimum":
        return ov.minimum(a, b)
    elif op_str == "NotEqual":
        return ov.not_equal(a, b)
    elif op_str == "Power":
        return ov.power(a, b)