NVIDIA Holoscan SDK v0.4.0
v0.4.0

holoscan.core

This module provides a Python API for the core C++ API classes.

The Application class is the primary class that should be derived from to create a custom application.

holoscan.core.Application(*args, **kwargs)

Application class.

holoscan.core.Arg

Class representing a typed argument.

holoscan.core.ArgContainerType

Enum class for an Arg's container type.

holoscan.core.ArgElementType

Enum class for an Arg's element type.

holoscan.core.ArgList

Class representing a list of arguments.

holoscan.core.ArgType

Class containing argument type info.

holoscan.core.Component

Base component class.

holoscan.core.ComponentSpec

Component specification class.

holoscan.core.ConditionType

Enum class for Condition types.

holoscan.core.Condition

Class representing a condition.

holoscan.core.Config

Configuration class.

holoscan.core.DLDevice

DLDevice class.

holoscan.core.DLDeviceType

Members:

holoscan.core.ExecutionContext

Class representing an execution context.

holoscan.core.Executor

Executor class.

holoscan.core.Fragment(*args, **kwargs)

Fragment class.

holoscan.core.Graph

Abstract base class for all graphs

holoscan.core.InputContext

Class representing an input context.

holoscan.core.IOSpec

I/O specification class.

holoscan.core.Message

Class representing a message.

holoscan.core.Operator(*args, **kwargs)

Operator class.

holoscan.core.OperatorSpec

Operator specification class.

holoscan.core.OutputContext

Class representing an output context.

holoscan.core.Resource

Class representing a resource.

holoscan.core.Tensor

alias of holoscan.core._core.PyTensor

holoscan.core.arg_to_py_object(arg)

Utility that converts an Arg to a corresponding Python object.

holoscan.core.arglist_to_kwargs(arglist)

Utility that converts an ArgList to a Python kwargs dictionary.

holoscan.core.kwargs_to_arglist(**kwargs)

Utility that converts a set of python keyword arguments to an ArgList.

holoscan.core.py_object_to_arg(obj[, name])

Utility that converts a single python argument to a corresponding Arg type.

class holoscan.core.Application(*args, **kwargs)

Bases: holoscan.core._core.Application

Application class.

Attributes

executor

Get the executor associated with the fragment.

graph

Get the computation graph associated with the fragment.

name

The fragment's name.

Methods

add_flow(*args, **kwargs)

Overloaded function.

add_operator(self, op)

Add an operator to the application.

application(self, arg0)

The application associated with the fragment.

compose(self)

The compose method of the application.

config(*args, **kwargs)

Overloaded function.

from_config(self, key)

Retrieve parameters from the associated configuration.

kwargs(self, key)

Retrieve a dictionary parameters from the associated configuration.

run(self)

The run method of the application.

__init__(self: holoscan.core._core.Application) → None

Application class.

add_flow(*args, **kwargs)

Overloaded function.

  1. add_flow(self: holoscan.core._core.Application, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None

  2. add_flow(self: holoscan.core._core.Application, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator, port_pairs: Set[Tuple[str, str]]) -> None

Connect two operators associated with the fragment.

Parameters
upstream_opholoscan.core.Operator

Source operator.

downstream_opholoscan.core.Operator

Destination operator.

port_pairsSequence of (str, str) tuples

Sequence of ports to connect. The first element of each 2-tuple is a port from upstream_op while the second element is the port of downstream_op to which it connects.

3. add_flow(self: holoscan.core._core.Application, upstream_frag: holoscan.core._core.Fragment, downstream_frag: holoscan.core._core.Fragment) -> None

4. add_flow(self: holoscan.core._core.Application, upstream_frag: holoscan.core._core.Fragment, downstream_frag: holoscan.core._core.Fragment, port_pairs: Set[Tuple[str, str]]) -> None

add_operator(self: holoscan.core._core.Application, op: holoscan.core._core.Operator) → None

Add an operator to the application.

Parameters
opholoscan.core.Operator

The operator to add.

application(self: holoscan.core._core.Fragment, arg0: holoscan::Application) → holoscan.core._core.Fragment

The application associated with the fragment.

Returns
appholoscan.core.Application

compose(self: holoscan.core._core.Application) → None

The compose method of the application.

This method should be called after config, but before run in order to compose the computation graph.

config(*args, **kwargs)

Overloaded function.

  1. config(self: holoscan.core._core.Fragment, config_file: str, prefix: str = ‘’) -> None

Set the configuration file associated with the fragment.

Parameters
config_filestr

The path to the configuration file (in YAML format).

prefixstr, optional

TODO

2. config(self: holoscan.core._core.Fragment) -> holoscan.core._core.Config

Get the configuration associated with the fragment.

Returns
configholoscan.core.Config

property executor

Get the executor associated with the fragment.

from_config(self: holoscan.core._core.Fragment, key: str) → object

Retrieve parameters from the associated configuration.

Parameters
keystr

The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.

Returns
argsholoscan.core.ArgList

An argument list associated with the key.

property graph

Get the computation graph associated with the fragment.

kwargs(self: holoscan.core._core.Fragment, key: str) → dict

Retrieve a dictionary parameters from the associated configuration.

Parameters
keystr

The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.

Returns
kwargsdict

A Python dict containing the parameters in the configuration file under the specified key.

property name

The fragment’s name.

Returns
namestr

run(self: holoscan.core._core.Application) → None

The run method of the application.

This method runs the computation. It must have first been initialized via config and compose.

class holoscan.core.Arg

Bases: pybind11_builtins.pybind11_object

Class representing a typed argument.

Attributes

arg_type

ArgType info corresponding to the argument.

has_value

Boolean flag indicating whether a value has been assigned to the argument.

name

The name of the argument.

__init__(self: holoscan.core._core.Arg, name: str) → None

Class representing a typed argument.

Parameters
namestr, optional

The argument’s name.

property arg_type

ArgType info corresponding to the argument.

Returns
arg_typeholoscan.core.ArgType

property has_value

Boolean flag indicating whether a value has been assigned to the argument.

property name

The name of the argument.

Returns
namestr

class holoscan.core.ArgContainerType

Bases: pybind11_builtins.pybind11_object

Enum class for an Arg’s container type.

Members:

NATIVE

VECTOR

ARRAY

Attributes

name

value

ARRAY =

NATIVE =

VECTOR =

__init__(self: holoscan.core._core.ArgContainerType, value: int) → None

property name

property value

class holoscan.core.ArgElementType

Bases: pybind11_builtins.pybind11_object

Enum class for an Arg’s element type.

Members:

CUSTOM

BOOLEAN

INT8

UNSIGNED8

INT16

UNSIGNED16

INT32

UNSIGNED32

INT64

UNSIGNED64

FLOAT32

FLOAT64

STRING

HANDLE

YAML_NODE

IO_SPEC

CONDITION

RESOURCE

Attributes

name

value

BOOLEAN =

CONDITION =

CUSTOM =

FLOAT32 =

FLOAT64 =

HANDLE =

INT16 =

INT32 =

INT64 =

INT8 =

IO_SPEC =

RESOURCE =

STRING =

UNSIGNED16 =

UNSIGNED32 =

UNSIGNED64 =

UNSIGNED8 =

YAML_NODE =

__init__(self: holoscan.core._core.ArgElementType, value: int) → None

property name

property value

class holoscan.core.ArgList

Bases: pybind11_builtins.pybind11_object

Class representing a list of arguments.

Attributes

args

The underlying list of Arg objects.

name

The name of the argument list.

size

The number of arguments in the list.

Methods

add(*args, **kwargs)

Overloaded function.

clear(self)

Clear the argument list.

__init__(self: holoscan.core._core.ArgList) → None

Class representing a list of arguments.

add(*args, **kwargs)

Overloaded function.

  1. add(self: holoscan.core._core.ArgList, arg: holoscan.core._core.Arg) -> None

Add an argument to the list.

  1. add(self: holoscan.core._core.ArgList, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the list.

property args

The underlying list of Arg objects.

clear(self: holoscan.core._core.ArgList) → None

Clear the argument list.

property name

The name of the argument list.

Returns
namestr

property size

The number of arguments in the list.

class holoscan.core.ArgType

Bases: pybind11_builtins.pybind11_object

Class containing argument type info.

Attributes

container_type

The container type of the argument.

element_type

The element type of the argument.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: holoscan.core._core.ArgType) -> None

Class containing argument type info.

  1. __init__(self: holoscan.core._core.ArgType, element_type: holoscan.core._core.ArgElementType, container_type: holoscan.core._core.ArgContainerType) -> None

Class containing argument type info.

Parameters
element_typeholoscan.core.ArgElementType

Element type of the argument.

container_typeholoscan.core.ArgContainerType

Container type of the argument.

property container_type

The container type of the argument.

property element_type

The element type of the argument.

class holoscan.core.Component

Bases: pybind11_builtins.pybind11_object

Base component class.

Attributes

args

The list of arguments associated with the component.

fragment

The fragment containing the component.

id

The identifier of the component.

name

The name of the component.

Methods

add_arg(*args, **kwargs)

Overloaded function.

initialize(self)

Initialize the component.

__init__(self: holoscan.core._core.Component) → None

Base component class.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property fragment

The fragment containing the component.

Returns
nameholoscan.core.Fragment

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.core._core.Component) → None

Initialize the component.

property name

The name of the component.

Returns
namestr

class holoscan.core.ComponentSpec

Bases: pybind11_builtins.pybind11_object

Component specification class.

Attributes

fragment

The fragment that the component belongs to.

params

The parameters associated with the component.

__init__(self: holoscan.core._core.ComponentSpec, fragment: holoscan::Fragment) → None

Component specification class.

Parameters
fragmentholoscan.core.Fragment

The fragment that the component belongs to.

property fragment

The fragment that the component belongs to.

Returns
nameholoscan.core.Fragment

property params

The parameters associated with the component.

class holoscan.core.Condition

Bases: holoscan.core._core.Component

Class representing a condition.

Attributes

args

The list of arguments associated with the component.

fragment

Fragment that the condition belongs to.

id

The identifier of the component.

name

The name of the condition.

Methods

add_arg(*args, **kwargs)

Overloaded function.

initialize(self)

initialization method for the condition.

setup(self, arg0)

setup method for the condition.

__init__(self: holoscan.core._core.Condition, *args, **kwargs) → None

Class representing a condition.

Can be initialized with any number of Python positional and keyword arguments.

If a 'name' keyword argument is provided, it must be a str and will be used to set the name of the Operator.

If a 'fragment' keyword argument is provided, it must be of type holoscan.core.Fragment (or holoscan.core.Application). A single Fragment object can also be provided positionally instead.

Any other arguments will be cast from a Python argument type to a C++ Arg and stored in self.args. (For details on how the casting is done, see the py_object_to_arg utility).

Parameters
*args

Positional arguments.

**kwargs

Keyword arguments.

Raises
RuntimeError

If 'name' kwarg is provided, but is not of str type. If multiple arguments of type Fragment are provided. If any other arguments cannot be converted to Arg type via py_object_to_arg.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property fragment

Fragment that the condition belongs to.

Returns
nameholoscan.core.Fragment

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.core._core.Condition) → None

initialization method for the condition.

property name

The name of the condition.

Returns
namestr

setup(self: holoscan.core._core.Condition, arg0: holoscan::ComponentSpec) → None

setup method for the condition.

class holoscan.core.ConditionType

Bases: pybind11_builtins.pybind11_object

Enum class for Condition types.

Members:

NONE

MESSAGE_AVAILABLE

DOWNSTREAM_MESSAGE_AFFORDABLE

COUNT

BOOLEAN

Attributes

name

value

BOOLEAN =

COUNT =

DOWNSTREAM_MESSAGE_AFFORDABLE =

MESSAGE_AVAILABLE =

NONE =

__init__(self: holoscan.core._core.ConditionType, value: int) → None

property name

property value

class holoscan.core.Config

Bases: pybind11_builtins.pybind11_object

Configuration class.

Represents configuration parameters as read from a YAML file.

Attributes

config_file

The configuration file (in YAML format) associated with the Config object.

prefix

TODO

__init__(self: holoscan.core._core.Config, config_file: str, prefix: str = '') → None

Configuration class.

Represents configuration parameters as read from a YAML file.

Parameters
config_filestr

The path to the configuration file (in YAML format).

prefixstr, optional

TODO

property config_file

The configuration file (in YAML format) associated with the Config object.

property prefix

TODO

class holoscan.core.DLDevice

Bases: pybind11_builtins.pybind11_object

DLDevice class.

Attributes

device_id

The device id (int).

device_type

The device type (DLDeviceType).

__init__(self: holoscan.core._core.DLDevice, arg0: holoscan.core._core.DLDeviceType, arg1: int) → None

property device_id

The device id (int).

property device_type

The device type (DLDeviceType).

The following device types are supported:

  • DLDeviceType.DLCPU: system memory (kDLCPU)

  • DLDeviceType.DLCUDA: CUDA GPU memory (kDLCUDA)

  • DLDeviceType.DLCUDAHost: CUDA pinned memory (kDLCUDAHost)

  • DLDeviceType.DLCUDAManaged: CUDA managed memory (kDLCUDAManaged)

class holoscan.core.DLDeviceType

Bases: pybind11_builtins.pybind11_object

Members:

DLCPU

DLCUDA

DLCUDAHOST

DLCUDAMANAGED

Attributes

name

value

DLCPU =

DLCUDA =

DLCUDAHOST =

DLCUDAMANAGED =

__init__(self: holoscan.core._core.DLDeviceType, value: int) → None

property name

property value

class holoscan.core.ExecutionContext

Bases: pybind11_builtins.pybind11_object

Class representing an execution context.

__init__(*args, **kwargs)

class holoscan.core.Executor

Bases: pybind11_builtins.pybind11_object

Executor class.

Attributes

context

The corresponding GXF context.

context_uint64

The corresponding GXF context represented as a 64-bit unsigned integer address

fragment

The fragment that the executor belongs to.

Methods

run(self, arg0)

Method that can be called to run the executor.

__init__(self: holoscan.core._core.Executor, fragment: holoscan::Fragment) → None

Executor class.

Parameters
fragmentholoscan.core.Fragment

The fragment that the executor is associated with.

property context

The corresponding GXF context. This will be an opaque PyCapsule object.

property context_uint64

The corresponding GXF context represented as a 64-bit unsigned integer address

property fragment

The fragment that the executor belongs to.

Returns
nameholoscan.core.Fragment

run(self: holoscan.core._core.Executor, arg0: holoscan.graphs._graphs.Graph) → None

Method that can be called to run the executor.

class holoscan.core.Fragment(*args, **kwargs)

Bases: holoscan.core._core.Fragment

Fragment class.

Attributes

executor

Get the executor associated with the fragment.

graph

Get the computation graph associated with the fragment.

name

The fragment's name.

Methods

add_flow(*args, **kwargs)

Overloaded function.

add_operator(self, op)

Add an operator to the fragment.

application(self, arg0)

The application associated with the fragment.

compose(self)

The compose method of the Fragment.

config(*args, **kwargs)

Overloaded function.

from_config(self, key)

Retrieve parameters from the associated configuration.

kwargs(self, key)

Retrieve a dictionary parameters from the associated configuration.

run(self)

The run method of the Fragment.

__init__(self: holoscan.core._core.Fragment) → None

Fragment class.

add_flow(*args, **kwargs)

Overloaded function.

  1. add_flow(self: holoscan.core._core.Fragment, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None

  2. add_flow(self: holoscan.core._core.Fragment, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator, port_pairs: Set[Tuple[str, str]]) -> None

Connect two operators associated with the fragment.

Parameters
upstream_opholoscan.core.Operator

Source operator.

downstream_opholoscan.core.Operator

Destination operator.

port_pairsSequence of 2-tuples

Sequence of ports to connect. The first element of each 2-tuple is a port from upstream_op while the second element is the port of downstream_op to which it connects.

add_operator(self: holoscan.core._core.Fragment, op: holoscan.core._core.Operator) → None

Add an operator to the fragment.

Parameters
opholoscan.core.Operator

The operator to add.

application(self: holoscan.core._core.Fragment, arg0: holoscan::Application) → holoscan.core._core.Fragment

The application associated with the fragment.

Returns
appholoscan.core.Application

compose(self: holoscan.core._core.Fragment) → None

The compose method of the Fragment.

This method should be called after config, but before run in order to compose the computation graph.

config(*args, **kwargs)

Overloaded function.

  1. config(self: holoscan.core._core.Fragment, config_file: str, prefix: str = ‘’) -> None

Set the configuration file associated with the fragment.

Parameters
config_filestr

The path to the configuration file (in YAML format).

prefixstr, optional

TODO

2. config(self: holoscan.core._core.Fragment) -> holoscan.core._core.Config

Get the configuration associated with the fragment.

Returns
configholoscan.core.Config

property executor

Get the executor associated with the fragment.

from_config(self: holoscan.core._core.Fragment, key: str) → object

Retrieve parameters from the associated configuration.

Parameters
keystr

The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.

Returns
argsholoscan.core.ArgList

An argument list associated with the key.

property graph

Get the computation graph associated with the fragment.

kwargs(self: holoscan.core._core.Fragment, key: str) → dict

Retrieve a dictionary parameters from the associated configuration.

Parameters
keystr

The key within the configuration file to retrieve. This can also be a specific component of the parameter via syntax ‘key.sub_key’.

Returns
kwargsdict

A Python dict containing the parameters in the configuration file under the specified key.

property name

The fragment’s name.

Returns
namestr

run(self: holoscan.core._core.Fragment) → None

The run method of the Fragment.

This method runs the computation. It must have first been initialized via config and compose.

class holoscan.core.Graph

Bases: pybind11_builtins.pybind11_object

Abstract base class for all graphs

__init__(*args, **kwargs)

class holoscan.core.IOSpec

Bases: pybind11_builtins.pybind11_object

I/O specification class.

Attributes

conditions

List of Condition objects associated with this I/O specification.

io_type

The type (input or output) of the I/O specification class.

name

The name of the I/O specification class.

resource

Resource class associated with this I/O specification.

Methods

IOType

Enum representing the I/O specification type (input or output).

condition(self, arg0, **kwargs)

Add a condition to this input/output.

class IOType

Bases: pybind11_builtins.pybind11_object

Enum representing the I/O specification type (input or output).

Members:

INPUT

OUTPUT

Attributes

name

value

INPUT =

OUTPUT =

__init__(self: holoscan.core._core.IOSpec.IOType, value: int) → None

property name

property value

__init__(self: holoscan.core._core.IOSpec, op_spec: holoscan::OperatorSpec, name: str, io_type: holoscan::IOSpec::IOType) → None

I/O specification class.

Parameters
op_specholoscan.core.OperatorSpec

Operator specification class of the associated operator.

namestr

The name of the IOSpec object.

io_typeholoscan.core.IOSpec.IOType

Enum indicating whether this is an input or output specification.

condition(self: holoscan.core._core.IOSpec, arg0: holoscan.core._core.ConditionType, **kwargs)holoscan.core._core.IOSpec

Add a condition to this input/output.

The following ConditionTypes are supported:

  • ConditionType.NONE

  • ConditionType.MESSAGE_AVAILABLE

  • ConditionType.DOWNSTREAM_MESSAGE_AFFORDABLE

  • ConditionType.COUNT

  • ConditionType.BOOLEAN

Parameters
kindholoscan.core.ConditionType

The type of the condition.

**kwargs

Python keyword arguments that will be cast to an ArgList associated with the condition.

Returns
objholoscan.core.IOSpec

The self object.

property conditions

List of Condition objects associated with this I/O specification.

Returns
conditionlist of holoscan.core.Condition

property io_type

The type (input or output) of the I/O specification class.

Returns
io_typeholoscan.core.IOSpec.IOType

property name

The name of the I/O specification class.

Returns
namestr

property resource

Resource class associated with this I/O specification.

Returns
resourceholoscan.core.Resource

class holoscan.core.InputContext

Bases: pybind11_builtins.pybind11_object

Class representing an input context.

Methods

receive(self, name)

__init__(*args, **kwargs)

receive(self: holoscan.core._core.InputContext, name: str) → None

class holoscan.core.Message

Bases: pybind11_builtins.pybind11_object

Class representing a message.

A message is a data structure that is used to pass data between operators. It wraps a std::any object and provides a type-safe interface to access the data.

This class is used by the holoscan::gxf::GXFWrapper to support the Holoscan native operator. The holoscan::gxf::GXFWrapper will hold the object of this class and delegate the message to the Holoscan native operator.

__init__(*args, **kwargs)

class holoscan.core.Operator(*args, **kwargs)

Bases: holoscan.core._core.Operator

Operator class.

Attributes

args

The list of arguments associated with the component.

conditions

Conditions associated with the operator.

fragment

The fragment that the operator belongs to.

id

The identifier of the component.

name

The name of the operator.

operator_type

The operator type.

resources

Resources associated with the operator.

spec

Methods

OperatorType

Members:

add_arg(*args, **kwargs)

Overloaded function.

compute(self, arg0, arg1, arg2)

Operator compute method.

initialize(self)

Operator initialization method.

setup(spec)

Default implementation of setup method.

start(self)

Operator start method.

stop(self)

Operator stop method.

class OperatorType

Bases: pybind11_builtins.pybind11_object

Members:

NATIVE

GXF

Attributes

name

value

GXF =

NATIVE =

__init__(self: holoscan.core._core.Operator.OperatorType, value: int) → None

property name

property value

__init__(self: holoscan.core._core.Operator, arg0: object, *args, **kwargs) → None

Operator class.

Can be initialized with any number of Python positional and keyword arguments.

If a 'name' keyword argument is provided, it must be a str and will be used to set the name of the Operator.

If a fragment keyword argument is provided, it must be of type holoscan.core.Fragment (or holoscan.core.Application). A single Fragment object can also be provided positionally instead.

Condition classes will be added to self.conditions, Resource classes will be added to self.resources, and any other arguments will be cast from a Python argument type to a C++ Arg and stored in self.args. (For details on how the casting is done, see the py_object_to_arg utility). When a Condition or Resource is provided via a kwarg, it’s name will be automatically be updated to the name of the kwarg.

Parameters
*args

Positional arguments.

**kwargs

Keyword arguments.

Raises
RuntimeError

If 'name' kwarg is provided, but is not of str type. If multiple arguments of type Fragment are provided. If any other arguments cannot be converted to Arg type via py_object_to_arg.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

compute(self: holoscan.core._core.Operator, arg0: holoscan.core._core.InputContext, arg1: holoscan.core._core.OutputContext, arg2: holoscan.core._core.ExecutionContext) → None

Operator compute method. This method defines the primary computation to be executed by the operator.

property conditions

Conditions associated with the operator.

property fragment

The fragment that the operator belongs to.

Returns
nameholoscan.core.Fragment

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.core._core.Operator) → None

Operator initialization method.

property name

The name of the operator.

Returns
namestr

property operator_type

The operator type.

holoscan.core.Operator.OperatorType enum representing the type of the operator. The two types currently implemented are native and GXF.

property resources

Resources associated with the operator.

setup(spec: holoscan.core._core.OperatorSpec)

Default implementation of setup method.

property spec

start(self: holoscan.core._core.Operator) → None

Operator start method.

stop(self: holoscan.core._core.Operator) → None

Operator stop method.

class holoscan.core.OperatorSpec

Bases: holoscan.core._core.ComponentSpec

Operator specification class.

Attributes

fragment

The fragment that the component belongs to.

params

The parameters associated with the component.

Methods

input(*args, **kwargs)

Overloaded function.

output(*args, **kwargs)

Overloaded function.

__init__(self: holoscan.core._core.OperatorSpec, fragment: holoscan::Fragment) → None

Operator specification class.

Parameters
fragmentholoscan.core.Fragment

The fragment that this operator belongs to.

property fragment

The fragment that the component belongs to.

Returns
nameholoscan.core.Fragment

input(*args, **kwargs)

Overloaded function.

  1. input(self: holoscan.core._core.OperatorSpec) -> holoscan.core._core.IOSpec

Add an input to the specification.

  1. input(self: holoscan.core._core.OperatorSpec, name: str) -> holoscan.core._core.IOSpec

Add a named input to the specification.

Parameters
namestr

The name of the input port.

output(*args, **kwargs)

Overloaded function.

  1. output(self: holoscan.core._core.OperatorSpec) -> holoscan.core._core.IOSpec

Add an outputput to the specification.

  1. output(self: holoscan.core._core.OperatorSpec, name: str) -> holoscan.core._core.IOSpec

Add a named output to the specification.

Parameters
namestr

The name of the output port.

property params

The parameters associated with the component.

class holoscan.core.OutputContext

Bases: pybind11_builtins.pybind11_object

Class representing an output context.

Methods

OutputType

Members:

emit(self, data[, name])

class OutputType

Bases: pybind11_builtins.pybind11_object

Members:

SHARED_POINTER

GXF_ENTITY

Attributes

name

value

GXF_ENTITY =

SHARED_POINTER =

__init__(self: holoscan.core._core.OutputContext.OutputType, value: int) → None

property name

property value

__init__(*args, **kwargs)

emit(self: holoscan.core._core.OutputContext, data: object, name: str = '') → None

class holoscan.core.Resource

Bases: holoscan.core._core.Component

Class representing a resource.

Attributes

args

The list of arguments associated with the component.

fragment

Fragment that the resource belongs to.

id

The identifier of the component.

name

The name of the resource.

Methods

add_arg(*args, **kwargs)

Overloaded function.

initialize(self)

initialization method for the resource.

setup(self, arg0)

setup method for the resource.

__init__(self: holoscan.core._core.Resource, *args, **kwargs) → None

Class representing a resource.

Can be initialized with any number of Python positional and keyword arguments.

If a 'name' keyword argument is provided, it must be a str and will be used to set the name of the Operator.

If a 'fragment' keyword argument is provided, it must be of type holoscan.core.Fragment (or holoscan.core.Application). A single Fragment object can also be provided positionally instead.

Any other arguments will be cast from a Python argument type to a C++ Arg and stored in self.args. (For details on how the casting is done, see the py_object_to_arg utility).

Parameters
*args

Positional arguments.

**kwargs

Keyword arguments.

Raises
RuntimeError

If 'name' kwarg is provided, but is not of str type. If multiple arguments of type Fragment are provided. If any other arguments cannot be converted to Arg type via py_object_to_arg.

add_arg(*args, **kwargs)

Overloaded function.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None

Add an argument to the component.

  1. add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None

Add a list of arguments to the component.

property args

The list of arguments associated with the component.

Returns
arglistholoscan.core.ArgList

property fragment

Fragment that the resource belongs to.

Returns
nameholoscan.core.Fragment

property id

The identifier of the component.

The identifier is initially set to -1, and will become a valid value when the component is initialized.

With the default executor (holoscan.gxf.GXFExecutor), the identifier is set to the GXF component ID.

Returns
idint

initialize(self: holoscan.core._core.Resource) → None

initialization method for the resource.

property name

The name of the resource.

Returns
namestr

setup(self: holoscan.core._core.Resource, arg0: holoscan::ComponentSpec) → None

setup method for the resource.

holoscan.core.Tensor

alias of holoscan.core._core.PyTensor

holoscan.core.arg_to_py_object(arg: holoscan.core._core.Arg) → object

Utility that converts an Arg to a corresponding Python object.

Parameters
argholoscan.core.Arg

The argument to convert.

Returns
objAny

Python object corresponding to the provided argument. For example, an argument of any integer type will become a Python int while std::vector<double> would become a list of Python floats.

holoscan.core.arglist_to_kwargs(arglist: holoscan.core._core.ArgList) → dict

Utility that converts an ArgList to a Python kwargs dictionary.

Parameters
arglistholoscan.core.ArgList

The argument list to convert.

Returns
kwargsdict

Python dictionary with keys matching the names of the arguments in ArgList. The values will be converted as for arg_to_py_object.

holoscan.core.kwargs_to_arglist(**kwargs)holoscan.core._core.ArgList

Utility that converts a set of python keyword arguments to an ArgList.

Parameters
**kwargs

The python keyword arguments to convert.

Returns
arglistholoscan.core.ArgList

ArgList class corresponding to the provided keyword values. The argument names will match the keyword names. Values will be converted as for py_object_to_arg.

holoscan.core.py_object_to_arg(obj: object, name: str = '')holoscan.core._core.Arg

Utility that converts a single python argument to a corresponding Arg type.

Parameters
valueAny

The python value to convert.

Returns
objholoscan.core.Arg

Arg class corresponding to the provided value. For example a Python float will become an Arg containing a C++ double while a list of Python ints would become an Arg corresponding to a std::vector<uint64_t>.

namestr, optional

A name to assign to the argument.

© Copyright 2022, NVIDIA. Last updated on Jun 28, 2023.