Remove set_from from samples, update docstrings (#11889)

This commit is contained in:
Bartek Szmelczynski 2022-06-15 12:10:00 +02:00 committed by GitHub
parent 594c3dac49
commit 6033e52dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View File

@ -76,7 +76,7 @@ int tmain(int argc, tchar* argv[]) {
// - input() provides information about a single model input
// - reuse precision and shape from already available `input_tensor`
// - layout of data is 'NHWC'
ppp.input().tensor().set_from(input_tensor).set_layout(tensor_layout);
ppp.input().tensor().set_shape(input_shape).set_element_type(input_type).set_layout(tensor_layout);
// 2) Adding explicit preprocessing steps:
// - convert layout to 'NCHW' (from 'NHWC' specified above at tensor layout)
// - apply linear resize from tensor spatial dims to model spatial dims

View File

@ -57,7 +57,8 @@ def main():
# - reuse precision and shape from already available `input_tensor`
# - layout of data is 'NHWC'
ppp.input().tensor() \
.set_from(input_tensor) \
.set_shape(input_tensor.shape) \
.set_element_type(Type.u8) \
.set_layout(Layout('NHWC')) # noqa: ECE001, N400
# 2) Adding explicit preprocessing steps:

View File

@ -301,7 +301,17 @@ static void regclass_graph_InputTensorInfo(py::module m) {
[](ov::preprocess::InputTensorInfo& self, const ov::Tensor& tensor) {
return &self.set_from(tensor);
},
py::arg("runtime_tensor"));
py::arg("runtime_tensor"),
R"(
Helper function to reuse element type and shape from user's created tensor. Overwrites previously
set shape and element type via `set_shape` and `set_element_type' methods. This method should be
used only in case if runtime tensor is already known and avaiable before.
:param runtime_tensor: User's created tensor
:type type: openvino.runtime.Tensor
:return: Reference to itself, allows chaining of calls in client's code in a builder-like manner.
:rtype: openvino.runtime.preprocess.InputTensorInfo
)");
info.def(
"set_from",
@ -309,7 +319,17 @@ static void regclass_graph_InputTensorInfo(py::module m) {
// Convert to contiguous array if not already C-style.
return &self.set_from(Common::tensor_from_numpy(numpy_array, false));
},
py::arg("runtime_tensor"));
py::arg("runtime_tensor"),
R"(
Helper function to reuse element type and shape from user's created tensor. Overwrites previously
set shape and element type via `set_shape` and `set_element_type' methods. This method should be
used only in case if runtime tensor is already known and avaiable before.
:param runtime_tensor: User's created numpy array
:type type: numpy.ndarray
:return: Reference to itself, allows chaining of calls in client's code in a builder-like manner.
:rtype: openvino.runtime.preprocess.InputTensorInfo
)");
}
static void regclass_graph_OutputTensorInfo(py::module m) {