Skip to content

Commit

Permalink
return IENetwork instead of Function
Browse files Browse the repository at this point in the history
  • Loading branch information
akuporos committed Aug 29, 2023
1 parent c235196 commit 7a7f1db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions docs/snippets/ov_preprocessing_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
operation_name = "data"

core = ie.IECore()
func = get_ngraph_model()
caps = ng.Function.to_capsule(func)
network = ie.IENetwork(caps)
network = get_ngraph_model()


#! [mean_scale]
Expand Down
6 changes: 2 additions & 4 deletions docs/snippets/ov_properties_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import openvino.runtime.properties as props
import openvino.runtime.properties.hint as hints

from utils import get_model, get_ngraph_model
from utils import get_model

core = ov.Core()

Expand Down Expand Up @@ -63,9 +63,7 @@
core.set_config({"PERF_COUNT": "YES"}, "CPU")
#! [core_set_config]

func = get_ngraph_model()
caps = ng.Function.to_capsule(func)
net = ie.IENetwork(caps)
net = get_ngraph_model()

#! [core_load_network]
exec_network = core.load_network(net, "MULTI", {"DEVICE_PRIORITIES": "CPU, GPU",
Expand Down
8 changes: 5 additions & 3 deletions docs/snippets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ def get_ngraph_model(input_shape = None, input_dtype=np.float32):
input_shape = [1, 3, 32, 32]
param = ng.opset11.parameter(input_shape, input_dtype, name="data")
relu = ng.opset11.relu(param, name="relu")
model = Function([relu], [param], "test_model")
func = Function([relu], [param], "test_model")
caps = ng.Function.to_capsule(func)
net = ie.IENetwork(caps)

assert model is not None
return model
assert net is not None
return net


def get_image(shape = (1, 3, 32, 32), dtype = "float32"):
Expand Down

0 comments on commit 7a7f1db

Please sign in to comment.