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.
|
Application class. |
Class representing a typed argument. |
|
Enum class for an Arg's container type. |
|
Enum class for an Arg's element type. |
|
Class representing a list of arguments. |
|
Class containing argument type info. |
|
Base component class. |
|
Component specification class. |
|
Enum class for Condition types. |
|
Class representing a condition. |
|
Configuration class. |
|
DLDevice class. |
|
Members: |
|
Class representing an execution context. |
|
Executor class. |
|
|
Fragment class. |
Abstract base class for all graphs |
|
Class representing an input context. |
|
I/O specification class. |
|
Class representing a message. |
|
|
Operator class. |
Operator specification class. |
|
Class representing an output context. |
|
Class representing a resource. |
|
alias of |
|
Utility that converts an Arg to a corresponding Python object. |
|
|
Utility that converts an ArgList to a Python kwargs dictionary. |
|
Utility that converts a set of python keyword arguments to an ArgList. |
|
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
Get the executor associated with the fragment.
Get the computation graph associated with the fragment.
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.
add_flow(self: holoscan.core._core.Application, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None
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_op
holoscan.core.Operator
- downstream_op
holoscan.core.Operator
- port_pairsSequence of (str, str) tuples
- 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
Source operator.
Destination operator.
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.
- upstream_op
- add_operator(self: holoscan.core._core.Application, op: holoscan.core._core.Operator) → None
Add an operator to the application.
- Parameters
- op
holoscan.core.Operator
The operator to add.
- op
- application(self: holoscan.core._core.Fragment, arg0: holoscan::Application) → holoscan.core._core.Fragment
The application associated with the fragment.
- Returns
- app
holoscan.core.Application
- app
- compose(self: holoscan.core._core.Application) → None
The compose method of the application.
This method should be called after
config
, but beforerun
in order to compose the computation graph.- config(*args, **kwargs)
Overloaded function.
config(self: holoscan.core._core.Fragment, config_file: str, prefix: str = ‘’) -> None
Set the configuration file associated with the fragment.
- Parameters
- config_filestr
- prefixstr, optional
- 2. config(self: holoscan.core._core.Fragment) -> holoscan.core._core.Config
- Get the configuration associated with the fragment.
The path to the configuration file (in YAML format).
TODO
- Returns
- config
holoscan.core.Config
- 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
- args
holoscan.core.ArgList
An argument list associated with the key.
- args
- 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
andcompose
.
- class holoscan.core.Arg
Bases:
pybind11_builtins.pybind11_object
Class representing a typed argument.
Attributes
ArgType info corresponding to the argument.
Boolean flag indicating whether a value has been assigned to the argument.
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_type
holoscan.core.ArgType
- arg_type
- 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
value
-
ARRAY =
-
NATIVE =
-
VECTOR =
- __init__(self: holoscan.core._core.ArgContainerType, value: int) → None
- property name
- property value
-
ARRAY =
- 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
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
-
BOOLEAN =
- class holoscan.core.ArgList
Bases:
pybind11_builtins.pybind11_object
Class representing a list of arguments.
Attributes
The underlying list of Arg objects.
The name of the argument list.
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)
add(self: holoscan.core._core.ArgList, arg: holoscan.core._core.Arg) -> None
add(self: holoscan.core._core.ArgList, arg: holoscan.core._core.ArgList) -> None
Overloaded function.
Add an argument to the list.
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
The container type of the argument.
The element type of the argument.
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: holoscan.core._core.ArgType) -> None
Class containing argument type info.
__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_type
holoscan.core.ArgElementType
- container_type
holoscan.core.ArgContainerType
Element type of the argument.
Container type of the argument.
- element_type
- 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
The list of arguments associated with the component.
The fragment containing the component.
The identifier of the component.
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)
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None
Overloaded function.
Add an argument to the component.
Add a list of arguments to the component.
- property args
The list of arguments associated with the component.
- Returns
- arglist
holoscan.core.ArgList
- arglist
- property fragment
The fragment containing the component.
- Returns
- name
holoscan.core.Fragment
- name
- 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
The fragment that the component belongs to.
The parameters associated with the component.
- __init__(self: holoscan.core._core.ComponentSpec, fragment: holoscan::Fragment) → None
Component specification class.
- Parameters
- fragment
holoscan.core.Fragment
The fragment that the component belongs to.
- fragment
- property fragment
The fragment that the component belongs to.
- Returns
- name
holoscan.core.Fragment
- name
- property params
The parameters associated with the component.
- class holoscan.core.Condition
Bases:
holoscan.core._core.Component
Class representing a condition.
Attributes
The list of arguments associated with the component.
Fragment that the condition belongs to.
The identifier of the component.
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 astr
and will be used to set the name of the Operator.If a
'fragment'
keyword argument is provided, it must be of typeholoscan.core.Fragment
(orholoscan.core.Application
). A singleFragment
object can also be provided positionally instead.Any other arguments will be cast from a Python argument type to a C++
Arg
and stored inself.args
. (For details on how the casting is done, see thepy_object_to_arg
utility).- Parameters
- *args
- **kwargs
Positional arguments.
Keyword arguments.
- Raises
- RuntimeError
If
'name'
kwarg is provided, but is not of str type. If multiple arguments of typeFragment
are provided. If any other arguments cannot be converted to Arg type viapy_object_to_arg
.
- add_arg(*args, **kwargs)
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None
Overloaded function.
Add an argument to the component.
Add a list of arguments to the component.
- property args
The list of arguments associated with the component.
- Returns
- arglist
holoscan.core.ArgList
- arglist
- property fragment
Fragment that the condition belongs to.
- Returns
- name
holoscan.core.Fragment
- name
- 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
value
-
BOOLEAN =
-
COUNT =
-
DOWNSTREAM_MESSAGE_AFFORDABLE =
-
MESSAGE_AVAILABLE =
-
NONE =
- __init__(self: holoscan.core._core.ConditionType, value: int) → None
- property name
- property value
-
BOOLEAN =
- class holoscan.core.Config
Bases:
pybind11_builtins.pybind11_object
Configuration class.
Represents configuration parameters as read from a YAML file.
Attributes
The configuration file (in YAML format) associated with the Config object.
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
- prefixstr, optional
The path to the configuration file (in YAML format).
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
The device id (int).
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
DLDeviceType.DLCPU: system memory (kDLCPU)
DLDeviceType.DLCUDA: CUDA GPU memory (kDLCUDA)
DLDeviceType.DLCUDAHost: CUDA pinned memory (kDLCUDAHost)
DLDeviceType.DLCUDAManaged: CUDA managed memory (kDLCUDAManaged)
The device type (DLDeviceType).
The following device types are supported:
- class holoscan.core.DLDeviceType
Bases:
pybind11_builtins.pybind11_object
Members:
DLCPU
DLCUDA
DLCUDAHOST
DLCUDAMANAGED
Attributes
value
-
DLCPU =
-
DLCUDA =
-
DLCUDAHOST =
-
DLCUDAMANAGED =
- __init__(self: holoscan.core._core.DLDeviceType, value: int) → None
- property name
- property value
-
DLCPU =
- 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
The corresponding GXF context.
The corresponding GXF context represented as a 64-bit unsigned integer address
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
- fragment
holoscan.core.Fragment
The fragment that the executor is associated with.
- fragment
- 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
- name
holoscan.core.Fragment
- name
- 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
Get the executor associated with the fragment.
Get the computation graph associated with the fragment.
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.
add_flow(self: holoscan.core._core.Fragment, upstream_op: holoscan.core._core.Operator, downstream_op: holoscan.core._core.Operator) -> None
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_op
holoscan.core.Operator
- downstream_op
holoscan.core.Operator
- port_pairsSequence of 2-tuples
Source operator.
Destination operator.
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.
- upstream_op
- add_operator(self: holoscan.core._core.Fragment, op: holoscan.core._core.Operator) → None
Add an operator to the fragment.
- Parameters
- op
holoscan.core.Operator
The operator to add.
- op
- application(self: holoscan.core._core.Fragment, arg0: holoscan::Application) → holoscan.core._core.Fragment
The application associated with the fragment.
- Returns
- app
holoscan.core.Application
- app
- compose(self: holoscan.core._core.Fragment) → None
The compose method of the Fragment.
This method should be called after
config
, but beforerun
in order to compose the computation graph.- config(*args, **kwargs)
Overloaded function.
config(self: holoscan.core._core.Fragment, config_file: str, prefix: str = ‘’) -> None
Set the configuration file associated with the fragment.
- Parameters
- config_filestr
- prefixstr, optional
- 2. config(self: holoscan.core._core.Fragment) -> holoscan.core._core.Config
- Get the configuration associated with the fragment.
The path to the configuration file (in YAML format).
TODO
- Returns
- config
holoscan.core.Config
- 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
- args
holoscan.core.ArgList
An argument list associated with the key.
- args
- 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
andcompose
.
- 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
List of Condition objects associated with this I/O specification.
The type (input or output) of the I/O specification class.
The name of the I/O specification class.
Resource class associated with this I/O specification.
Methods
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
value
-
INPUT =
-
OUTPUT =
- __init__(self: holoscan.core._core.IOSpec.IOType, value: int) → None
- property name
- property value
-
INPUT =
- __init__(self: holoscan.core._core.IOSpec, op_spec: holoscan::OperatorSpec, name: str, io_type: holoscan::IOSpec::IOType) → None
I/O specification class.
- Parameters
- op_spec
holoscan.core.OperatorSpec
- namestr
- io_type
holoscan.core.IOSpec.IOType
Operator specification class of the associated operator.
The name of the IOSpec object.
Enum indicating whether this is an input or output specification.
- op_spec
- 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
- kind
holoscan.core.ConditionType
- **kwargs
The type of the condition.
Python keyword arguments that will be cast to an ArgList associated with the condition.
- kind
- Returns
- obj
holoscan.core.IOSpec
The self object.
- obj
- property conditions
List of Condition objects associated with this I/O specification.
- Returns
- conditionlist of
holoscan.core.Condition
- conditionlist of
- property io_type
The type (input or output) of the I/O specification class.
- Returns
- io_type
holoscan.core.IOSpec.IOType
- io_type
- property name
The name of the I/O specification class.
- Returns
- namestr
- property resource
Resource class associated with this I/O specification.
- Returns
- resource
holoscan.core.Resource
- 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. Theholoscan::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
The list of arguments associated with the component.
Conditions associated with the operator.
The fragment that the operator belongs to.
The identifier of the component.
The name of the operator.
The operator type.
Resources associated with the operator.
spec
Methods
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
value
-
GXF =
-
NATIVE =
- __init__(self: holoscan.core._core.Operator.OperatorType, value: int) → None
- property name
- property value
-
GXF =
- __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 astr
and will be used to set the name of the Operator.If a
fragment
keyword argument is provided, it must be of typeholoscan.core.Fragment
(orholoscan.core.Application
). A singleFragment
object can also be provided positionally instead.Condition
classes will be added toself.conditions
,Resource
classes will be added toself.resources
, and any other arguments will be cast from a Python argument type to a C++Arg
and stored inself.args
. (For details on how the casting is done, see thepy_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
- **kwargs
Positional arguments.
Keyword arguments.
- Raises
- RuntimeError
If
'name'
kwarg is provided, but is not of str type. If multiple arguments of typeFragment
are provided. If any other arguments cannot be converted to Arg type viapy_object_to_arg
.
- add_arg(*args, **kwargs)
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None
Overloaded function.
Add an argument to the component.
Add a list of arguments to the component.
- property args
The list of arguments associated with the component.
- Returns
- arglist
holoscan.core.ArgList
- 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
- name
holoscan.core.Fragment
- name
- 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
The fragment that the component belongs to.
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
- fragment
holoscan.core.Fragment
The fragment that this operator belongs to.
- fragment
- property fragment
The fragment that the component belongs to.
- Returns
- name
holoscan.core.Fragment
- name
- input(*args, **kwargs)
Overloaded function.
input(self: holoscan.core._core.OperatorSpec) -> holoscan.core._core.IOSpec
Add an input to the specification.
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.
output(self: holoscan.core._core.OperatorSpec) -> holoscan.core._core.IOSpec
Add an outputput to the specification.
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
Members:
emit
(self, data[, name])- class OutputType
Bases:
pybind11_builtins.pybind11_object
Members:
SHARED_POINTER
GXF_ENTITY
Attributes
value
-
GXF_ENTITY =
-
SHARED_POINTER =
- __init__(self: holoscan.core._core.OutputContext.OutputType, value: int) → None
- property name
- property value
-
GXF_ENTITY =
- __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
The list of arguments associated with the component.
Fragment that the resource belongs to.
The identifier of the component.
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 astr
and will be used to set the name of the Operator.If a
'fragment'
keyword argument is provided, it must be of typeholoscan.core.Fragment
(orholoscan.core.Application
). A singleFragment
object can also be provided positionally instead.Any other arguments will be cast from a Python argument type to a C++
Arg
and stored inself.args
. (For details on how the casting is done, see thepy_object_to_arg
utility).- Parameters
- *args
- **kwargs
Positional arguments.
Keyword arguments.
- Raises
- RuntimeError
If
'name'
kwarg is provided, but is not of str type. If multiple arguments of typeFragment
are provided. If any other arguments cannot be converted to Arg type viapy_object_to_arg
.
- add_arg(*args, **kwargs)
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.Arg) -> None
add_arg(self: holoscan.core._core.Component, arg: holoscan.core._core.ArgList) -> None
Overloaded function.
Add an argument to the component.
Add a list of arguments to the component.
- property args
The list of arguments associated with the component.
- Returns
- arglist
holoscan.core.ArgList
- arglist
- property fragment
Fragment that the resource belongs to.
- Returns
- name
holoscan.core.Fragment
- name
- 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
- arg
holoscan.core.Arg
The argument to convert.
- arg
- 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
- arglist
holoscan.core.ArgList
The argument list to convert.
- arglist
- 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
- arglist
holoscan.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
.- arglist
- 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
- obj
holoscan.core.Arg
- namestr, optional
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>
.A name to assign to the argument.
- obj