We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TensorMemory.set_tensor
24.10
No response
The Python impl of TensorMemory.set_tensor will reshape the incoming tensor to 2 dimensions.
The problem is the C++ impl doesn't perform this, neither does the Python impl of the TensorMemory constructor or TensorMemory.set_tensors.
TensorMemory
TensorMemory.set_tensors
import cupy as cp from morpheus.config import CppConfig from morpheus.messages.memory.tensor_memory import TensorMemory def repo(use_cpp:bool): CppConfig.set_should_use_cpp(use_cpp) mem = TensorMemory(count=3, tensors={"input_ids": cp.array([1, 2, 3]), "input_mask": cp.array([1, 1, 1]), "segment_ids": cp.array([0, 0, 1])}) mem.set_tensor('new_tensor', cp.array([4, 5, 6])) print(f"use_cpp: {use_cpp}\n{mem.get_tensors()}\n") repo(True) repo(False)
use_cpp: True {'input_ids': array([1, 2, 3]), 'input_mask': array([1, 1, 1]), 'new_tensor': array([4, 5, 6]), 'segment_ids': array([0, 0, 1])} use_cpp: False {'input_ids': array([1, 2, 3]), 'input_mask': array([1, 1, 1]), 'segment_ids': array([0, 0, 1]), 'new_tensor': array([[4], [5], [6]])}
use_cpp: True {'input_ids': array([1, 2, 3]), 'input_mask': array([1, 1, 1]), 'new_tensor': array([4, 5, 6]), 'segment_ids': array([0, 0, 1])}
use_cpp: False {'input_ids': array([1, 2, 3]), 'input_mask': array([1, 1, 1]), 'segment_ids': array([0, 0, 1]), 'new_tensor': array([[4], [5], [6]])}
[Paste the results of print_env.sh here, it will be hidden by default]
The text was updated successfully, but these errors were encountered:
Remove inconsistent tensor reshaping issue nv-morpheus#1955
485764c
e13e345
dagardner-nv
Successfully merging a pull request may close this issue.
Version
24.10
Which installation method(s) does this occur on?
No response
Describe the bug.
The Python impl of
TensorMemory.set_tensor
will reshape the incoming tensor to 2 dimensions.The problem is the C++ impl doesn't perform this, neither does the Python impl of the
TensorMemory
constructor orTensorMemory.set_tensors
.Minimum reproducible example
Relevant log output
Click here to see error details
Full env printout
Click here to see environment details
Other/Misc.
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: