Package org.intel.openvino
Class InferRequest
- java.lang.Object
-
- org.intel.openvino.Wrapper
-
- org.intel.openvino.InferRequest
-
public class InferRequest extends Wrapper
This is a class of infer request that can be run in asynchronous or synchronous manners.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInferRequest(long addr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddelete(long nativeObj)Tensorget_output_tensor()Gets an output tensor for inference.Tensorget_tensor(java.lang.String tensorName)Gets an input/output tensor for inference by tensor name.voidinfer()Infers specified input(s) in synchronous mode.voidrelease()Detele the native object to release resources.voidset_input_tensor(Tensor tensor)Sets an input tensor to infer models with single input.voidset_output_tensor(Tensor tensor)Sets an output tensor to infer models with single output.voidstart_async()Starts inference of specified input(s) in asynchronous mode.voidwait_async()Waits for the result to become available.-
Methods inherited from class org.intel.openvino.Wrapper
finalize, getNativeObjAddr
-
-
-
-
Method Detail
-
infer
public void infer()
Infers specified input(s) in synchronous mode.It blocks all methods of
InferRequestwhile request is ongoing (running or waiting in a queue). Calling any method leads to throwning the ov::Busy exception.
-
set_input_tensor
public void set_input_tensor(Tensor tensor)
Sets an input tensor to infer models with single input.If model has several inputs, an exception is thrown.
- Parameters:
tensor- Reference to the input tensor.
-
get_output_tensor
public Tensor get_output_tensor()
Gets an output tensor for inference.- Returns:
- Output tensor for the model. If model has several outputs, an exception is thrown.
-
start_async
public void start_async()
Starts inference of specified input(s) in asynchronous mode.It returns immediately. Inference starts also immediately. Calling any method while the request in a running state leads to throwning the ov::Busy exception.
-
wait_async
public void wait_async()
Waits for the result to become available. Blocks until the result becomes available.
-
set_output_tensor
public void set_output_tensor(Tensor tensor)
Sets an output tensor to infer models with single output.If model has several outputs, an exception is thrown.
- Parameters:
tensor- Reference to the output tensor.
-
get_tensor
public Tensor get_tensor(java.lang.String tensorName)
Gets an input/output tensor for inference by tensor name.- Parameters:
tensorName- Name of a tensor to get.- Returns:
- The tensor with name "tensorName". If the tensor is not found, an exception is thrown.
-
release
public void release()
Detele the native object to release resources.This mehtod is protected from double deallocation
-
-