forked from nv-morpheus/Morpheus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Python bindings for TensorMemory (nv-morpheus#655)
* Makes the Python API compatible with the Python C++ bindings for `TensorMemory`, `InferenceMemory` & `ResponseMemory` classes. * Replaces the `tensors` attribute for memory classes with explicit `get_tensors` and `set_tensors` methods. * Make get_input, set_input, get_output & set_output methods actual methods on the base * Associated interface proxy classes now inherit from each other limiting redundant python conversion code. * Expose `MultiTensorMessage` class to Python allowing Python inheritance hierarchy to match that of C++, and consolidating some duplicated code. The reason for removing the attribute is that on the C++ side returning a Python representation of a tensor is rather costly and is always returned as a copy. We want to avoid the obvious bugs that can occur with anyone doing: ```python m = tensor_memory.TensorMemory(10) m.tensors['c'] = cp.zeros(count) ``` Which would have worked when C++ execution is disabled, and the old API is implying that it *should* work. Instead the API is changed to: ```python m = tensor_memory.TensorMemory(10) tensors = m.get_tensors() tensors['c'] = cp.zeros(count) m.set_tensors(tensors) ``` fixes nv-morpheus#604 Authors: - David Gardner (https://github.com/dagardner-nv) - Michael Demoret (https://github.com/mdemoret-nv) Approvers: - Michael Demoret (https://github.com/mdemoret-nv) URL: nv-morpheus#655
- Loading branch information
1 parent
e3c6f52
commit 9cb5a4d
Showing
45 changed files
with
1,521 additions
and
977 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.