Program Listing for File response_memory.cpp

Return to documentation for file (morpheus/_lib/src/messages/memory/response_memory.cpp)

Copy
Copied!
            

#include "morpheus/messages/memory/response_memory.hpp" #include "morpheus/utilities/cupy_util.hpp" #include <pybind11/pytypes.h> #include <string> #include <utility>// for move namespace morpheus { /****** Component public implementations *******************/ /****** ResponseMemory****************************************/ ResponseMemory::ResponseMemory(size_t count) : TensorMemory(count) {} ResponseMemory::ResponseMemory(size_t count, tensor_map_t &&tensors) : TensorMemory(count, std::move(tensors)) {} bool ResponseMemory::has_output(const std::string &name) const { return this->has_tensor(name); } /****** ResponseMemoryInterfaceProxy *************************/ pybind11::object ResponseMemoryInterfaceProxy::get_output(ResponseMemory &self, const std::string &name) { // Directly return the tensor object if (!self.has_tensor(name)) { throw pybind11::key_error(); } return CupyUtil::tensor_to_cupy(self.tensors[name]); } TensorObject ResponseMemoryInterfaceProxy::get_output_tensor(ResponseMemory &self, const std::string &name) { // Directly return the tensor object if (!self.has_tensor(name)) { throw pybind11::key_error(); } return self.tensors[name]; } } // namespace morpheus

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