예제 #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 unary_op(op_str, a):
    if op_str == "Abs":
        return ov.abs(a)
    elif op_str == "Acos":
        return ov.acos(a)
    elif op_str == "Acosh":
        return ov.acosh(a)
    elif op_str == "Asin":
        return ov.asin(a)
    elif op_str == "Asinh":
        return ov.asinh(a)
    elif op_str == "Atan":
        return ov.atan(a)
    elif op_str == "Atanh":
        return ov.atanh(a)
    elif op_str == "Ceiling":
        return ov.ceiling(a)
    elif op_str == "Cos":
        return ov.cos(a)
    elif op_str == "Cosh":
        return ov.cosh(a)
    elif op_str == "Floor":
        return ov.floor(a)
    elif op_str == "log":
        return ov.log(a)
    elif op_str == "exp":
        return ov.exp(a)
    elif op_str == "negative":
        return ov.negative(a)
    elif op_str == "Sign":
        return ov.sign(a)
    elif op_str == "Sin":
        return ov.sin(a)
    elif op_str == "Sinh":
        return ov.sinh(a)
    elif op_str == "Sqrt":
        return ov.sqrt(a)
    elif op_str == "Tan":
        return ov.tan(a)
    elif op_str == "Tanh":
        return ov.tanh(a)