[PyOV] AsyncInferQueue documentation notice about iteration limit (#18042)

This commit is contained in:
Anastasia Kuporosova 2023-06-15 09:23:26 +02:00 committed by GitHub
parent 52834659c4
commit 7fd394e87e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -120,6 +120,10 @@ The ``start_async`` function call is not required to be synchronized - it waits
:language: python :language: python
:fragment: [asyncinferqueue] :fragment: [asyncinferqueue]
.. warning::
``InferRequest`` objects that can be acquired by iterating over a ``AsyncInferQueue`` object or by ``[id]`` guaranteed to work with read-only methods like getting tensors.
Any mutating methods (e.g. start_async, set_callback) of a single request will put the parent AsyncInferQueue object in an invalid state.
Acquiring Results from Requests Acquiring Results from Requests
------------------------------- -------------------------------

View File

@ -280,6 +280,10 @@ class AsyncInferQueue(AsyncInferQueueBase):
def __iter__(self) -> Iterable[InferRequest]: def __iter__(self) -> Iterable[InferRequest]:
"""Allows to iterate over AsyncInferQueue. """Allows to iterate over AsyncInferQueue.
Resulting objects are guaranteed to work with read-only methods like getting tensors.
Any mutating methods (e.g. start_async, set_callback) of a single request
will put the parent AsyncInferQueue object in an invalid state.
:return: a generator that yields InferRequests. :return: a generator that yields InferRequests.
:rtype: Iterable[openvino.runtime.InferRequest] :rtype: Iterable[openvino.runtime.InferRequest]
""" """
@ -288,6 +292,10 @@ class AsyncInferQueue(AsyncInferQueueBase):
def __getitem__(self, i: int) -> InferRequest: def __getitem__(self, i: int) -> InferRequest:
"""Gets InferRequest from the pool with given i id. """Gets InferRequest from the pool with given i id.
Resulting object is guaranteed to work with read-only methods like getting tensors.
Any mutating methods (e.g. start_async, set_callback) of a request
will put the parent AsyncInferQueue object in an invalid state.
:param i: InferRequest id. :param i: InferRequest id.
:type i: int :type i: int
:return: InferRequests from the pool with given id. :return: InferRequests from the pool with given id.