Struct TensorMemoryInterfaceProxy

Derived Types

struct TensorMemoryInterfaceProxy

Interface proxy, used to insulate python bindings.

Subclassed by morpheus::InferenceMemoryInterfaceProxy, morpheus::ResponseMemoryInterfaceProxy

Public Static Functions

static std::shared_ptr<TensorMemory> init(TensorIndex count, pybind11::object &tensors)

Create and initialize a TensorMemory object, and return a shared pointer to the result. Each array in tensors should be of length count.

Parameters
  • count – : Lenght of each array in tensors

  • tensors – : Map of string on to cupy arrays

Returns

std::shared_ptr<TensorMemory>

static TensorIndex get_count(TensorMemory &self)

Get the count object.

Parameters

self

Returns

TensorIndex

static std::vector<std::string> tensor_names_getter(TensorMemory &self)

Returns a list of the current tensor names.

Parameters

self

Returns

std::vector<std::string>

static bool has_tensor(TensorMemory &self, std::string name)

Returns true if a tensor with the requested name exists in the tensors object.

Parameters

nameTensor name to lookup

static CupyUtil::py_tensor_map_t get_tensors(TensorMemory &self)

Get the tensors converted to CuPy arrays. Pybind11 will convert the std::map to a Python dict.

Parameters

self

Returns

py_tensor_map_t

static void set_tensors(TensorMemory &self, CupyUtil::py_tensor_map_t tensors)

Set the tensors object converting a map of CuPy arrays to Tensors.

Parameters
  • self

  • tensors

static pybind11::object get_tensor(TensorMemory &self, const std::string name)

Get the tensor object identified by name

Parameters
  • self

  • name

Throws

pybind11::key_error – When no matching tensor exists.

Returns

pybind11::object

static pybind11::object get_tensor_property(TensorMemory &self, const std::string name)

Same as get_tensor but used when the method is being bound to a python property.

Parameters
  • self

  • name

Throws

pybind11::attribute_error – When no matching tensor exists.

Returns

pybind11::object

static void set_tensor(TensorMemory &self, const std::string name, const pybind11::object &cupy_tensor)

Set the tensor object identified by name

Parameters
  • self

  • cupy_tensor

© Copyright 2023, NVIDIA. Last updated on Apr 19, 2023.