Skip to content

Commit 3400e94

Browse files
committed
Specify input layout (i.e. NHWC) explicitly in tests
Due to a change in the behavior of the upstream [`SetBlob`]( https://github.com/openvinotoolkit/openvino/pull/2402/files#diff-0ec2c2a8d308ceb06e9f0d16319099aa1bb461c49a19e51c5267ced413f25f77R278-R280), `infer_request.set_blob` would fail with a `GeneralError`. In tracking this down, it appears that the blob validation expects the "blocking descriptions" to match. In these tests, we import NHWC tensors so we must now explicitly set this as the input layout.
1 parent edd0912 commit 3400e94

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

crates/openvino/tests/classify-alexnet.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use util::{Prediction, Predictions};
1111
#[test]
1212
fn classify_alexnet() {
1313
let mut core = Core::new(None).unwrap();
14-
let network = core
14+
let mut network = core
1515
.read_network_from_file(
1616
&Fixture::graph().to_string_lossy(),
1717
&Fixture::weights().to_string_lossy(),
@@ -20,6 +20,7 @@ fn classify_alexnet() {
2020

2121
let input_name = &network.get_input_name(0).unwrap();
2222
assert_eq!(input_name, "data");
23+
network.set_input_layout(input_name, Layout::NHWC).unwrap();
2324
let output_name = &network.get_output_name(0).unwrap();
2425
assert_eq!(output_name, "prob");
2526

crates/openvino/tests/classify-inception.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use util::{Prediction, Predictions};
1111
#[test]
1212
fn classify_inception() {
1313
let mut core = Core::new(None).unwrap();
14-
let network = core
14+
let mut network = core
1515
.read_network_from_file(
1616
&Fixture::graph().to_string_lossy(),
1717
&Fixture::weights().to_string_lossy(),
@@ -20,6 +20,7 @@ fn classify_inception() {
2020

2121
let input_name = &network.get_input_name(0).unwrap();
2222
assert_eq!(input_name, "input");
23+
network.set_input_layout(input_name, Layout::NHWC).unwrap();
2324
let output_name = &network.get_output_name(0).unwrap();
2425
assert_eq!(output_name, "InceptionV3/Predictions/Softmax");
2526

crates/openvino/tests/classify-mobilenet.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use util::{Prediction, Predictions};
1212
#[test]
1313
fn classify_mobilenet() {
1414
let mut core = Core::new(None).unwrap();
15-
let network = core
15+
let mut network = core
1616
.read_network_from_file(
1717
&Fixture::graph().to_string_lossy(),
1818
&Fixture::weights().to_string_lossy(),
@@ -21,6 +21,7 @@ fn classify_mobilenet() {
2121

2222
let input_name = &network.get_input_name(0).unwrap();
2323
assert_eq!(input_name, "input");
24+
network.set_input_layout(input_name, Layout::NHWC).unwrap();
2425
let output_name = &network.get_output_name(0).unwrap();
2526
assert_eq!(output_name, "MobilenetV2/Predictions/Reshape_1");
2627

0 commit comments

Comments
 (0)