Beispiel #1
0
def test_compact_api_onnx():
    img = read_image()

    model = compile_model(test_net_onnx)
    assert(isinstance(model, CompiledModel))
    results = model.infer_new_request({"data": img})
    assert np.argmax(results[list(results)[0]]) == 2
Beispiel #2
0
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import numpy as np

#! [auto_compilation]
import openvino.runtime as ov

compiled_model = ov.compile_model("model.xml")
#! [auto_compilation]

#! [properties_example]
core = ov.Core()

input_a = ov.opset8.parameter([8])
res = ov.opset8.absolute(input_a)
model = ov.Model(res, [input_a])
compiled = core.compile_model(model, "CPU")

print(model.inputs)
print(model.outputs)

print(compiled.inputs)
print(compiled.outputs)
#! [properties_example]

#! [tensor_basics]
data_float64 = np.ones(shape=(2, 8))

tensor = ov.Tensor(data_float64)
assert tensor.element_type == ov.Type.f64