Remove legacy Python API (#17674)

This commit is contained in:
Ilya Churaev authored and GitHub committed 2023-05-23 16:17:26 +04:00
1 parent e2cb6dafe1
commit 294eb1a4d4
4 files changed
+3 -39

No files matched your search

@@ -535,7 +535,7 @@ cdef class IECore:
ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
ie.set_config(config={"DYN_BATCH_ENABLED": "YES"}, device_name="CPU")
ie.set_config(config={"PERF_COUNT": "YES"}, device_name="CPU")
"""
cdef map[string, string] c_config = dict_to_c_map(config)
self.impl.setConfig(c_config, device_name.encode())
@@ -1403,7 +1403,7 @@ cdef class InferRequest:
mem_state_vec.append(state)
return mem_state_vec
def set_blob(self, blob_name : str, blob : Blob, preprocess_info: PreProcessInfo = None):
def set_blob(self, blob_name : str, blob : Blob):
"""Sets user defined Blob for the infer request
:param blob_name: A name of input blob
@@ -1423,10 +1423,7 @@ cdef class InferRequest:
blob = Blob(td, blob_data)
exec_net.requests[0].set_blob(blob_name="input_blob_name", blob=blob),
"""
if preprocess_info:
deref(self.impl).setBlob(blob_name.encode(), blob._ptr, deref(preprocess_info._ptr))
else:
deref(self.impl).setBlob(blob_name.encode(), blob._ptr)
deref(self.impl).setBlob(blob_name.encode(), blob._ptr)
self._user_blobs[blob_name] = blob
cpdef infer(self, inputs=None):
@@ -363,12 +363,6 @@ void InferenceEnginePython::InferRequestWrap::setBlob(const std::string& blob_na
request_ptr.SetBlob(blob_name.c_str(), blob_ptr);
}
void InferenceEnginePython::InferRequestWrap::setBlob(const std::string& blob_name,
const InferenceEngine::Blob::Ptr& blob_ptr,
const InferenceEngine::PreProcessInfo& info) {
request_ptr.SetBlob(blob_name.c_str(), blob_ptr, info);
}
const InferenceEngine::PreProcessInfo& InferenceEnginePython::InferRequestWrap::getPreProcess(
const std::string& blob_name) {
return request_ptr.GetPreProcess(blob_name.c_str());
@@ -378,10 +372,6 @@ InferenceEngine::Blob::Ptr InferenceEnginePython::InferRequestWrap::getBlobPtr(c
return request_ptr.GetBlob(blob_name.c_str());
}
void InferenceEnginePython::InferRequestWrap::setBatch(int size) {
request_ptr.SetBatch(size);
}
std::vector<InferenceEnginePython::CVariableState> InferenceEnginePython::InferRequestWrap::queryState() {
auto queryStateVec = request_ptr.QueryState();
std::vector<InferenceEnginePython::CVariableState> memoryStates;
@@ -115,12 +115,6 @@ struct InferRequestWrap {
void setBlob(const std::string& blob_name, const InferenceEngine::Blob::Ptr& blob_ptr);
void setBlob(const std::string& name,
const InferenceEngine::Blob::Ptr& data,
const InferenceEngine::PreProcessInfo& info);
void setBatch(int size);
const InferenceEngine::PreProcessInfo& getPreProcess(const std::string& blob_name);
std::map<std::string, InferenceEnginePython::ProfileInfo> getPerformanceCounts();
@@ -401,23 +401,6 @@ def test_blob_setter(device):
assert np.allclose(res_1, res_2, atol=1e-2, rtol=1e-2)
def test_blob_setter_with_preprocess(device):
ie_core = ie.IECore()
net = ie_core.read_network(test_net_xml, test_net_bin)
exec_net = ie_core.load_network(network=net, device_name=device, num_requests=1)
img = generate_image()
tensor_desc = ie.TensorDesc("FP32", [1, 3, 32, 32], "NCHW")
img_blob = ie.Blob(tensor_desc, img)
preprocess_info = ie.PreProcessInfo()
preprocess_info.mean_variant = ie.MeanVariant.MEAN_IMAGE
request = exec_net.requests[0]
request.set_blob('data', img_blob, preprocess_info)
pp = request.preprocess_info["data"]
assert pp.mean_variant == ie.MeanVariant.MEAN_IMAGE
def test_getting_preprocess(device):
ie_core = ie.IECore()
net = ie_core.read_network(test_net_xml, test_net_bin)