openvino.VAContext

class openvino.VAContext

Bases: openvino._pyopenvino.RemoteContext

__init__(self: openvino._pyopenvino.VAContext, core: openvino._pyopenvino.Core, display: capsule, target_tile_id: int = - 1) None

Constructs remote context object from valid VA display handle.

Parameters
  • core (openvino.Core) – OpenVINO Runtime Core object.

  • device (Any) – A valid VADisplay to create remote context from.

  • target_tile_id (int) – Desired tile id within given context for multi-tile system. Default value (-1) means that root device should be used.

Returns

A context instance.

Return type

openvino.VAContext

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(self, core, display[, target_tile_id])

Constructs remote context object from valid VA display handle.

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

create_host_tensor(self, type, shape)

This method is used to create a host tensor object friendly for the device in current context.

create_tensor(self, type, shape, surface[, ...])

Create remote tensor from VA surface handle.

create_tensor_nv12(self, height, width, ...)

This function is used to obtain a NV12 tensor from NV12 VA decoder output.

get_device_name(self)

Returns name of a device on which the context is allocated.

get_params(self)

Returns a dict of device-specific parameters required for low-level operations with the underlying context.

__class__

alias of pybind11_builtins.pybind11_type

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(self: openvino._pyopenvino.VAContext, core: openvino._pyopenvino.Core, display: capsule, target_tile_id: int = - 1) None

Constructs remote context object from valid VA display handle.

Parameters
  • core (openvino.Core) – OpenVINO Runtime Core object.

  • device (Any) – A valid VADisplay to create remote context from.

  • target_tile_id (int) – Desired tile id within given context for multi-tile system. Default value (-1) means that root device should be used.

Returns

A context instance.

Return type

openvino.VAContext

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)
__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

create_host_tensor(self: openvino._pyopenvino.RemoteContext, type: openvino._pyopenvino.Type, shape: openvino._pyopenvino.Shape) openvino._pyopenvino.Tensor

This method is used to create a host tensor object friendly for the device in current context. For example, GPU context may allocate USM host memory (if corresponding extension is available), which could be more efficient than regular host memory.

GIL is released while running this function.

Parameters
Returns

A tensor instance with device friendly memory.

Return type

openvino.Tensor

create_tensor(self: openvino._pyopenvino.VAContext, type: openvino._pyopenvino.Type, shape: openvino._pyopenvino.Shape, surface: int, plane: int = 0) VASurfaceTensorWrapper

Create remote tensor from VA surface handle.

GIL is released while running this function.

Parameters
  • type (openvino.Type) – Defines the element type of the tensor.

  • shape (openvino.Shape) – Defines the shape of the tensor.

  • surface (int) – VASurfaceID to create tensor from.

  • plane (int) – An index of a plane inside VASurfaceID to create tensor from. Default: 0

Returns

A remote tensor instance wrapping VASurfaceID.

Return type

openvino.VASurfaceTensor

create_tensor_nv12(self: openvino._pyopenvino.VAContext, height: int, width: int, nv12_surface: int) tuple

This function is used to obtain a NV12 tensor from NV12 VA decoder output. The result contains two remote tensors for Y and UV planes of the surface.

GIL is released while running this function.

Parameters
  • height (int) – A height of Y plane.

  • width (int) – A width of Y plane

  • nv12_surface (int) – NV12 VASurfaceID to create NV12 from.

Returns

A pair of remote tensors for each plane.

Return type

Tuple[openvino.VASurfaceTensor, openvino.VASurfaceTensor]

get_device_name(self: openvino._pyopenvino.RemoteContext) str

Returns name of a device on which the context is allocated.

Returns

A device name string in fully specified format <device_name>[.<device_id>[.<tile_id>]].

Return type

str

get_params(self: openvino._pyopenvino.RemoteContext) Dict[str, openvino._pyopenvino.OVAny]

Returns a dict of device-specific parameters required for low-level operations with the underlying context. Parameters include device/context handles, access flags, etc. Content of the returned dict depends on remote execution context that is currently set on the device (working scenario).

Returns

A dictionary of device-specific parameters.

Return type

dict