Skip to content
New issue

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

[BUG]: Python impl of TensorMemory.set_tensor reshapes incoming tensors #1955

Closed
2 tasks done
dagardner-nv opened this issue Oct 17, 2024 · 0 comments · Fixed by #1851
Closed
2 tasks done

[BUG]: Python impl of TensorMemory.set_tensor reshapes incoming tensors #1955

dagardner-nv opened this issue Oct 17, 2024 · 0 comments · Fixed by #1851
Assignees
Labels
bug Something isn't working

Comments

@dagardner-nv
Copy link
Contributor

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 or TensorMemory.set_tensors.

Minimum reproducible example

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)

Relevant log output

Click here to see error details

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]])}

Full env printout

Click here to see environment details

[Paste the results of print_env.sh here, it will be hidden by default]

Other/Misc.

No response

Code of Conduct

  • I agree to follow Morpheus' Code of Conduct
  • I have searched the open bugs and have found no duplicates for this bug report
@dagardner-nv dagardner-nv added the bug Something isn't working label Oct 17, 2024
@dagardner-nv dagardner-nv self-assigned this Oct 17, 2024
dagardner-nv added a commit to dagardner-nv/Morpheus that referenced this issue Oct 17, 2024
@morpheus-bot-test morpheus-bot-test bot moved this from Todo to Review - Ready for Review in Morpheus Boards Oct 17, 2024
@mdemoret-nv mdemoret-nv added this to the 24.10 - Release milestone Oct 18, 2024
@rapids-bot rapids-bot bot closed this as completed in e13e345 Oct 18, 2024
@github-project-automation github-project-automation bot moved this from Review - Ready for Review to Done in Morpheus Boards Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants