Class MultiTensorMessage

Base Type

class MultiTensorMessage : public morpheus::DerivedMultiMessage<MultiTensorMessage, MultiMessage>

Base class for MultiInferenceMessage & MultiResponseMessage Contains a pointer to an instance of TensorMemory along with an offset & count to those tensors

mess_offset & mess_count refer to the range of records in meta. offset & count refer to the range of records in TensorMemory

While TensorMemory can contain multiple tensors, it is a requirement that they are all of the same length and that element N in each tensor refers to the same record

Public Functions

MultiTensorMessage(const MultiTensorMessage &other) = default

Default copy constructor.

MultiTensorMessage(std::shared_ptr<morpheus::MessageMeta> meta, std::size_t mess_offset, std::size_t mess_count, std::shared_ptr<morpheus::TensorMemory> memory, std::size_t offset, std::size_t count)

Construct a new Multi Tensor Message object.

Parameters
  • meta – Holds a data table, in practice a cudf DataFrame, with the ability to return both Python and C++ representations of the table

  • mess_offset – Offset into the metadata batch

  • mess_count – Messages count

  • memory – Shared pointer of a tensor memory

  • offset – Message offset in tensor memory instance

  • count – Message count in tensor memory instance

const TensorObject get_tensor(const std::string &name) const

Returns a tensor with the given name. Will halt on a fatal error if the tensor does not exist.

Parameters

name

Returns

const TensorObject

TensorObject get_tensor(const std::string &name)

Returns a tensor with the given name. Will halt on a fatal error if the tensor does not exist.

Parameters

name

Returns

TensorObject

void set_tensor(const std::string &name, const TensorObject &value)

Update the value of a given tensor. The tensor must already exist, otherwise this will halt on a fatal error.

Parameters
  • name

  • value

Public Members

std::shared_ptr<morpheus::TensorMemory> memory
std::size_t offset = {0}
std::size_t count = {0}

Protected Functions

virtual void get_slice_impl(std::shared_ptr<MultiMessage> new_message, std::size_t start, std::size_t stop) const override

Applies a slice of the attribures contained in new_message. Subclasses need only be concerned with their own attributes, and can safely avoid overriding this method if they don’t add any new attributes to their base.

Parameters
  • new_message

  • start

  • stop

void copy_ranges_impl(std::shared_ptr<MultiMessage> new_message, const std::vector<std::pair<std::size_t, std::size_t>> &ranges, size_t num_selected_rows) const override
std::shared_ptr<morpheus::TensorMemory> copy_input_ranges(const std::vector<std::pair<std::size_t, std::size_t>> &ranges, std::size_t num_selected_rows) const
TensorObject get_tensor_impl(const std::string &name) const

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