morpheus.messages.multi_inference_ae_message.MultiInferenceAEMessage
- class MultiInferenceAEMessage(*, meta, mess_offset=0, mess_count=- 1, memory=None, offset=0, count=- 1, model=None, train_scores_mean=nan, train_scores_std=nan)[source]
Bases:
morpheus.messages.multi_inference_message.MultiInferenceMessage
A stronger typed version of
MultiInferenceMessage
that is used for AE workloads. Helps ensure the proper inputs are set and eases debugging. Associates a user ID with a message.- Attributes
id
id_col
input
inputs
seq_ids
tensors
timestamp
user_id
Returns ID column values from
morpheus.pipeline.messages.MessageMeta.df
as list.Returns ID column values from
morpheus.pipeline.messages.MessageMeta.df
.Returns autoecoder input tensor.
Get inputs stored in the InferenceMemory container.
Returns sequence ids, which are used to keep track of messages in a multi-threaded environment.
Get tensors stored in the TensorMemory container sliced according to
offset
andcount
.Returns timestamp column values from morpheus.messages.MessageMeta.df as list.
Returns the user ID associated with this message.
Methods
copy_meta_ranges
(ranges[, mask])Perform a copy of the underlying dataframe for the given
ranges
of rows.copy_ranges
(ranges)Perform a copy of the current message, dataframe and tensors for the given
ranges
of rows.copy_tensor_ranges
(ranges[, mask])Perform a copy of the underlying tensor tensors for the given
ranges
of rows.from_message
(message, *[, meta, ...])Creates a new instance of a derived class from
MultiMessage
using an existing message as the template.Get the tensor that holds message ID information.
get_input
(name)Get input stored in the InferenceMemory container.
get_meta
([columns])Return column values from
morpheus.pipeline.messages.MessageMeta.df
.get_meta_list
([col_name])Return a column values from morpheus.messages.MessageMeta.df as a list.
get_slice
(start, stop)Perform a slice of the current message from
start
:stop
(excludingstop
)get_tensor
(name)Get tensor stored in the TensorMemory container.
set_meta
(columns, value)Set column values to
morpheus.pipelines.messages.MessageMeta.df
.- copy_meta_ranges(ranges, mask=None)[source]
Perform a copy of the underlying dataframe for the given
ranges
of rows.- Parameters
- rangestyping.List[typing.Tuple[int, int]]
- masktyping.Union[None, cupy.ndarray, numpy.ndarray]
Rows to include in the copy in the form of
[(`start_row
,stop_row
),…]` Thestop_row
isn’t included. For example to copy rows 1-2 & 5-7ranges=[(1, 3), (5, 8)]
Optionally specify rows as a cupy array (when using cudf Dataframes) or a numpy array (when using pandas Dataframes) of booleans. When not-None
ranges
will be ignored. This is useful as an optimization as this avoids needing to generate the mask on it’s own.- Returns
Dataframe
- copy_ranges(ranges)[source]
Perform a copy of the current message, dataframe and tensors for the given
ranges
of rows.- Parameters
- rangestyping.List[typing.Tuple[int, int]]
- ——-
- `MultiTensorMessage`
Rows to include in the copy in the form of
[(`start_row
,stop_row
),…]` Thestop_row
isn’t included. For example to copy rows 1-2 & 5-7ranges=[(1, 3), (5, 8)]
- copy_tensor_ranges(ranges, mask=None)[source]
Perform a copy of the underlying tensor tensors for the given
ranges
of rows.- Parameters
- rangestyping.List[typing.Tuple[int, int]]
- masktyping.Union[None, cupy.ndarray, numpy.ndarray]
Rows to include in the copy in the form of
[(`start_row
,stop_row
),…]` Thestop_row
isn’t included. For example to copy rows 1-2 & 5-7ranges=[(1, 3), (5, 8)]
Optionally specify rows as a cupy array (when using cudf Dataframes) or a numpy array (when using pandas Dataframes) of booleans. When not-None
ranges
will be ignored. This is useful as an optimization as this avoids needing to generate the mask on it’s own.- Returns
- typing.Dict[str, cupy.ndarray]
- classmethod from_message(message, *, meta=None, mess_offset=- 1, mess_count=- 1, memory=None, offset=- 1, count=- 1, **kwargs)[source]
Creates a new instance of a derived class from
MultiMessage
using an existing message as the template. This is very useful when a new message needs to be created with a single change to an existingMessageMeta
.When creating the new message, all required arguments for the class specified by
cls
will be pulled frommessage
unless otherwise specified in theargs
orkwargs
. Special handling is performed depending on whether or not a newmeta
object is supplied. If one is supplied, the offset and count defaults will be 0 andmeta.count
respectively. Otherwise offset and count will be pulled from the inputmessage
.- Parameters
- clstyping.Type[Self]
- messageMultiMessage
- metaMessageMeta, optional
- mess_offsetint, optional
- mess_countint, optional
- memoryTensorMemory, optional
- offsetint, optional
- countint, optional
The class to create
An existing message to use as a template. Can be a base or derived from
cls
as long as all arguments can be pulled frommessage
or proveded inkwargs
A new
MessageMeta
to use, by default NoneA new
mess_offset
to use, by default -1A new
mess_count
to use, by default -1A new
TensorMemory
to use. If supplied,offset
andcount
default to0
andmemory.count
respectively. By default NoneA new
offset
to use, by default -1A new
count
to use, by default -1- Returns
- Self
A new instance of type
cls
- Raises
- ValueError
If the incoming
message
is None
- get_id_tensor()[source]
Get the tensor that holds message ID information. Equivalent to
get_tensor(id_tensor_name)
- Returns
- cupy.ndarray
Array containing the ID information
- Raises
- KeyError
If
self.id_tensor_name
is not found in the tensors
- get_input(name)[source]
Get input stored in the InferenceMemory container. Alias for
MultiInferenceMessage.get_tensor
.- Parameters
- namestr
Input key name.
- Returns
- cupy.ndarray
Inference input.
- Raises
- KeyError
When no matching input tensor exists.
- get_meta(columns=None)[source]
Return column values from
morpheus.pipeline.messages.MessageMeta.df
.- Parameters
- columnstyping.Union[None, str, typing.List[str]]
Input column names. Returns all columns if
None
is specified. When a string is passed, aSeries
is returned. Otherwise aDataframe
is returned.- Returns
- Series or Dataframe
Column values from the dataframe.
- get_meta_list(col_name=None)[source]
Return a column values from morpheus.messages.MessageMeta.df as a list.
- Parameters
- col_namestr
Column name in the dataframe.
- Returns
- List[str]
Column values from the dataframe.
- get_slice(start, stop)[source]
Perform a slice of the current message from
start
:stop
(excludingstop
)For example to slice from rows 1-3 use
m.get_slice(1, 4)
. The returnedMultiTensorMessage
will contain references to the same underlying Dataframe and tensor tensors, and this calling this method is reletively low cost compared toMultiTensorMessage.copy_ranges
- Parameters
- startint
- stopint
- ——-
- `MultiTensorMessage`
Starting row of the slice
Stop of the slice
- get_tensor(name)[source]
Get tensor stored in the TensorMemory container.
- Parameters
- namestr
tensor key name.
- Returns
- cupy.ndarray
Inference tensor.
- property id: List[int]
Returns ID column values from
morpheus.pipeline.messages.MessageMeta.df
as list.- Returns
- List[int]
ID column values from the dataframe as list.
- property id_col
Returns ID column values from
morpheus.pipeline.messages.MessageMeta.df
.- Returns
- pandas.Series
ID column values from the dataframe.
- property input
Returns autoecoder input tensor.
- Returns
- cupy.ndarray
The autoencoder input tensor.
- property inputs
Get inputs stored in the InferenceMemory container. Alias for
MultiInferenceMessage.tensors
.- Returns
- cupy.ndarray
Inference inputs.
- property seq_ids
Returns sequence ids, which are used to keep track of messages in a multi-threaded environment.
- Returns
- cupy.ndarray
seq_ids
- set_meta(columns, value)[source]
Set column values to
morpheus.pipelines.messages.MessageMeta.df
.- Parameters
- columnstyping.Union[None, str, typing.List[str]]
- valueAny
Input column names. Sets the value for the corresponding column names. If
None
is specified, all columns will be used. If the column does not exist, a new one will be created.Value to apply to the specified columns. If a single value is passed, it will be broadcast to all rows. If a
Series
orDataframe
is passed, rows will be matched by index.
- property tensors
Get tensors stored in the TensorMemory container sliced according to
offset
andcount
.- Returns
- cupy.ndarray
Inference tensors.
- property timestamp: List[int]
Returns timestamp column values from morpheus.messages.MessageMeta.df as list.
- Returns
- List[int]
Timestamp column values from the dataframe as list.
- property user_id
Returns the user ID associated with this message.