morpheus.messages.multi_response_message.MultiResponseAEMessage

class MultiResponseAEMessage(*args, **kwargs)[source]

Bases: morpheus.messages.multi_response_message.MultiResponseProbsMessage

A stronger typed version of MultiResponseProbsMessage that is used for inference workloads that return a probability array. Helps ensure the proper outputs are set and eases debugging.

Attributes
id

Returns ID column values from morpheus.pipeline.messages.MessageMeta.df as list.

id_col

Returns ID column values from morpheus.pipeline.messages.MessageMeta.df.

outputs

Get outputs stored in the TensorMemory container.

probs

Probabilities of prediction.

timestamp

Returns timestamp column values from morpheus.messages.MessageMeta.df as list.

user_id

Methods

copy_meta_ranges(ranges[, mask])

Perform a copy of the underlying dataframe for the given ranges of rows.

copy_output_ranges(ranges[, mask])

Perform a copy of the underlying output tensors 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.

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_output(name)

Get output stored in the TensorMemory container.

get_slice(start, stop)

Perform a slice of the current message from start:stop (excluding stop)

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]]

Rows to include in the copy in the form of [(`start_row, stop_row),…]` The stop_row isn’t included. For example to copy rows 1-2 & 5-7 ranges=[(1, 3), (5, 8)]

masktyping.Union[None, cupy.ndarray, numpy.ndarray]

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_output_ranges(ranges, mask=None)[source]

Perform a copy of the underlying output tensors for the given ranges of rows.

Parameters
rangestyping.List[typing.Tuple[int, int]]

Rows to include in the copy in the form of [(`start_row, stop_row),…]` The stop_row isn’t included. For example to copy rows 1-2 & 5-7 ranges=[(1, 3), (5, 8)]

masktyping.Union[None, cupy.ndarray, numpy.ndarray]

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]
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]]

Rows to include in the copy in the form of [(`start_row, stop_row),…]` The stop_row isn’t included. For example to copy rows 1-2 & 5-7 ranges=[(1, 3), (5, 8)]

——-
`MultiResponseAEMessage`
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, a Series is returned. Otherwise a Dataframe 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_output(name)[source]

Get output stored in the TensorMemory container.

Parameters
namestr

Output key name.

Returns
cupy.ndarray

Inference output.

get_slice(start, stop)[source]

Perform a slice of the current message from start:stop (excluding stop)

For example to slice from rows 1-3 use m.get_slice(1, 4). The returned MultiResponseMessage will contain references to the same underlying Dataframe and output tensors, and this calling this method is reletively low cost compared to MultiResponseAEMessage.copy_ranges

Parameters
startint

Starting row of the slice

stopint

Stop of the slice

——-
`MultiResponseAEMessage`
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 outputs

Get outputs stored in the TensorMemory container.

Returns
cupy.ndarray

Inference outputs.

property probs

Probabilities of prediction.

Returns
cupy.ndarray

probabilities

set_meta(columns, value)[source]

Set column values to morpheus.pipelines.messages.MessageMeta.df.

Parameters
columnstyping.Union[None, str, typing.List[str]]

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.

valueAny

Value to apply to the specified columns. If a single value is passed, it will be broadcast to all rows. If a Series or Dataframe is passed, rows will be matched by index.

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.

© Copyright 2023, NVIDIA. Last updated on Feb 3, 2023.