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

Handle differnt dtype in MultiNestedTensor/MultiEmbeddingTensor #184

Open
akihironitta opened this issue Nov 7, 2023 · 3 comments
Open

Comments

@akihironitta
Copy link
Member

akihironitta commented Nov 7, 2023

num_rows = 10
tensor_list = [
    torch.rand((num_rows, 2, dtype=torch.float32),
    torch.rand((num_rows, 2, dtype=torch.long),
]
MultiEmbeddingTensor.from_list(tensor_list)  # should raise an exception or warning

You probably want to check if all items in xs are in the same dtype. If not, probably good to raise an error or a warning.

Originally posted by @yiweny in #181 (comment)

@akihironitta
Copy link
Member Author

We should either error out, raise a warning or simply documenting the behaviour, linking how PyTorch handles.

@weihua916
Copy link
Contributor

Good point! I think we can raise an informative error.

@akihironitta
Copy link
Member Author

akihironitta commented Nov 23, 2023

I feel like just documenting the behaviour is sufficient because PyTorch already makes it clear about type promotion https://pytorch.org/docs/stable/tensor_attributes.html#torch-dtype wdyt? (cc @yiweny)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants