Files
openvino/inference-engine/ie_bridges/python/tests/test_offline_api.py
Alexey Suhov 6478f1742a Align copyright notice in python scripts (CVS-51320) (#4974)
* Align copyright notice in python scripts (CVS-51320)
2021-03-26 17:54:28 +03:00

52 lines
1.3 KiB
Python

# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.inference_engine import IECore, IENetwork
from openvino.offline_transformations import ApplyMOCTransformations, ApplyLowLatencyTransformation, ApplyPruningTransformation
import ngraph as ng
from ngraph.impl.op import Parameter
from ngraph.impl import Function, Shape, Type
from conftest import model_path
test_net_xml, test_net_bin = model_path()
def get_test_cnnnetwork():
element_type = Type.f32
param = Parameter(element_type, Shape([1, 3, 22, 22]))
relu = ng.relu(param)
func = Function([relu], [param], 'test')
caps = Function.to_capsule(func)
cnnNetwork = IENetwork(caps)
assert cnnNetwork != None
return cnnNetwork
def test_moc_transformations():
net = get_test_cnnnetwork()
ApplyMOCTransformations(net, False)
f = ng.function_from_cnn(net)
assert f != None
assert len(f.get_ops()) == 3
def test_low_latency_transformations():
net = get_test_cnnnetwork()
ApplyLowLatencyTransformation(net)
f = ng.function_from_cnn(net)
assert f != None
assert len(f.get_ops()) == 3
def test_pruning_transformations():
net = get_test_cnnnetwork()
ApplyPruningTransformation(net)
f = ng.function_from_cnn(net)
assert f != None
assert len(f.get_ops()) == 3