intel / openvino-rs

Rust bindings for OpenVINO™
Apache License 2.0
82 stars 23 forks source link

Fix Blob::tensor_desc() #56

Closed chemicstry closed 1 year ago

chemicstry commented 1 year ago

This depends on #54.

Current implementation of Blob::tensor_desc() always panics, because it doesn't trim dimensions array and passes the full [u8; 8] into TensorDesc::new(), which panics with assertion failed: dimensions.len() < 8.

This change fixes that by constructing tensor_desc_t directly, since we have all the members of it. I also changed accessor functions to use MaybeUninit, which is faster. There is no need to initialize all of them with default values.

abrown commented 1 year ago

Let's merge #54 first; I'll take another look after that.

chemicstry commented 1 year ago

Ok, I will rebase this once #54 is merged.

abrown commented 1 year ago

@chemicstry, I think the failing test is due to not having the OpenVINO library available for whatever call that test is making. For the runtime version of these bindings, something like the following needs to happen to try to dynamically link up with the OpenVINO shared library (see other tests that do this):

openvino_sys::library::load().expect("unable to find an OpenVINO shared library");