def test_register_plugin(): ie = IECore() if ie.get_metric("CPU", "FULL_DEVICE_NAME") == "arm_compute::NEON": pytest.skip("Can't run on ARM plugin due-to MKLDNNPlugin specific test") ie.register_plugin("MKLDNNPlugin", "BLA") net = ie.read_network(model=test_net_xml, weights=test_net_bin) exec_net = ie.load_network(net, "BLA") assert isinstance(exec_net, ExecutableNetwork), "Cannot load the network to the registered plugin with name 'BLA'"
def test_register_plugin(): ie = IECore() ie.register_plugin("MKLDNNPlugin", "BLA") net = ie.read_network(model=test_net_xml, weights=test_net_bin) exec_net = ie.load_network(net, "BLA") assert isinstance( exec_net, ExecutableNetwork ), "Cannot load the network to the registered plugin with name 'BLA'"
def test_is_dynamic(): function = create_relu([-1, 3, 20, 20]) net = ng.function_to_cnn(function) ie = IECore() ie.register_plugin("openvino_template_plugin", "TEMPLATE") exec_net = ie.load_network(net, "TEMPLATE") assert exec_net.outputs["out"].is_dynamic p_shape = ng.partial_shape_from_data(exec_net.outputs["out"]) assert isinstance(p_shape, ng.impl.PartialShape) with pytest.raises(RuntimeError) as e: exec_net.outputs["out"].shape assert "Cannot return dims for Data with dynamic shapes!" in str(e.value)
def test_blob_set_shape_after_async_infer(): function = create_encoder([1, 4, 20, 20]) net = ng.function_to_cnn(function) net.reshape({"data": [(1, 5), 4, 20, 20]}) ie_core = IECore() ie_core.register_plugin("templatePlugin", "TEMPLATE") exec_net = ie_core.load_network(net, "TEMPLATE") request = exec_net.requests[0] request.async_infer({"data": np.ones([4, 4, 20, 20])}) with pytest.raises(RuntimeError) as e: request.input_blobs['data'].set_shape([3, 4, 20, 20]) assert "REQUEST_BUSY" in str(e.value) request.wait()
def test_create_two_exec_net(): function = create_relu([ ng.Dimension(0, 5), ng.Dimension(4), ng.Dimension(20), ng.Dimension(20) ]) net = ng.function_to_cnn(function) ie_core = IECore() ie_core.register_plugin("ov_template_plugin", "TEMPLATE") exec_net1 = ie_core.load_network(net, "TEMPLATE", num_requests=2) assert ng.function_from_cnn(net) != None exec_net2 = ie_core.load_network(net, "TEMPLATE", num_requests=2) assert ng.function_from_cnn(net) != None
def test_blob_set_shape_after_async_infer(): from conftest import create_ngraph_function import ngraph as ng function = create_ngraph_function([ ng.Dimension(0, 5), ng.Dimension(4), ng.Dimension(20), ng.Dimension(20) ]) net = ng.function_to_cnn(function) ie_core = IECore() ie_core.register_plugin("templatePlugin", "TEMPLATE") exec_net = ie_core.load_network(net, "TEMPLATE") request = exec_net.requests[0] request.async_infer({"data": np.ones([4, 4, 20, 20])}) with pytest.raises(RuntimeError) as e: request.input_blobs['data'].set_shape([3, 4, 20, 20]) assert "REQUEST_BUSY" in str(e.value)
def test_is_dynamic(): from conftest import create_ngraph_function import ngraph as ng function = create_ngraph_function([-1, 3, 20, 20]) net = ng.function_to_cnn(function) assert net.input_info["data"].input_data.is_dynamic assert net.outputs["out"].is_dynamic p_shape = ng.partial_shape_from_data(net.input_info["data"].input_data) assert isinstance(p_shape, ng.impl.PartialShape) p_shape = ng.partial_shape_from_data(net.outputs["out"]) assert isinstance(p_shape, ng.impl.PartialShape) with pytest.raises(RuntimeError) as e: net.input_info["data"].input_data.shape assert "Cannot return dims for Data with dynamic shapes!" in str(e.value) ie = IECore() ie.register_plugin("templatePlugin", "TEMPLATE") exec_net = ie.load_network(net, "TEMPLATE") assert exec_net.input_info["data"].input_data.is_dynamic p_shape = ng.partial_shape_from_data( exec_net.input_info["data"].input_data) assert isinstance(p_shape, ng.impl.PartialShape)