Skip to content

Commit

Permalink
Avoid unnecessary class method wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
abrown committed Jul 10, 2020
1 parent 341a392 commit d9bf2d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 0 additions & 4 deletions inference-engine/ie_bridges/rust/src/bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ std::unique_ptr<InferenceEngine::CNNNetwork> read_network(std::unique_ptr<Infere
return std::make_unique<InferenceEngine::CNNNetwork>(core->ReadNetwork(std::string(modelPath), std::string(binPath)));
}

void set_batch_size(std::unique_ptr<InferenceEngine::CNNNetwork> network, const size_t size) {
network->setBatchSize(size);
}

#endif //OPENVINO_BRIDGE_H
9 changes: 5 additions & 4 deletions inference-engine/ie_bridges/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod ffi {
) -> UniquePtr<CNNNetwork>;

type CNNNetwork;
pub fn set_batch_size(network: UniquePtr<CNNNetwork>, size: usize);
pub fn setBatchSize(self: &mut CNNNetwork, size: usize);
}
}

Expand Down Expand Up @@ -49,8 +49,8 @@ pub struct CNNNetwork {
}

impl CNNNetwork {
pub fn set_batch_size(self, size: usize) {
ffi::set_batch_size(self.instance, size)
pub fn set_batch_size(&mut self, size: usize) {
self.instance.setBatchSize(size)
}
}

Expand All @@ -76,11 +76,12 @@ mod test {
);
}

// FIXME this test relies on a pre-built model in the filesystem--avoid this.
#[test]
fn set_batch_size() {
let core = Core::new(None);
let dir = Path::new("../../../../test-openvino/");
let network = core.read_network(
let mut network = core.read_network(
&dir.join("frozen_inference_graph.xml").to_string_lossy(),
&dir.join("frozen_inference_graph.bin").to_string_lossy(),
);
Expand Down

0 comments on commit d9bf2d4

Please sign in to comment.