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

[BETA][BUG] Cannot return memory-primary types in tuples #516

Closed
lsh opened this issue Aug 25, 2023 · 5 comments
Closed

[BETA][BUG] Cannot return memory-primary types in tuples #516

lsh opened this issue Aug 25, 2023 · 5 comments
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-lang Tag for all issues related to language. mojo-repo Tag all issues with this label

Comments

@lsh
Copy link
Contributor

lsh commented Aug 25, 2023

Bug description

Returning tensors seems to fail.

Steps to reproduce

from tensor import Tensor

fn may_i_have_a_tuple_of_tensor() -> (Tensor[DType.float32], Tensor[DType.uint32]):
    return (Tensor[DType.float32](100, 3), Tensor[DType.uint32](100, 3))

let a: Tensor[DType.float32]
let b: Tensor[DType.uint32]
a, b = may_i_have_a_tuple_of_tensor()

outputs

error: Expression [8]:24:6: invalid call to 'get': result cannot bind generic !mlirtype to memory-only type 'Tensor[f32]'
    a, b = may_i_have_a_tuple_of_tensor()
    ~^~~

Expression [0]:1:1: function declared here
from memory.unsafe import Pointer
^

expression failed to parse (no further compiler diagnostics)

changing it to

let a,b = may_i_have_a_tuple_of_tensor()

outputs:

error: Expression [9]:22:5: declaration must have either a type or an initializer
    let a, b = may_i_have_a_tuple_of_tensor()

System information

No response

@lsh lsh added the bug Something isn't working label Aug 25, 2023
@Mogball Mogball changed the title [BETA]: Cannot return tensor tuples [BETA][BUG] Cannot return memory-primary in tuples Aug 25, 2023
@Mogball Mogball changed the title [BETA][BUG] Cannot return memory-primary in tuples [BETA][BUG] Cannot return memory-primary types in tuples Aug 25, 2023
@Mogball Mogball added the mojo label Sep 6, 2023
@goldiegadde goldiegadde removed the mojo label Sep 7, 2023
@Mogball Mogball added the mojo-lang Tag for all issues related to language. label Sep 7, 2023
@ematejska ematejska added the mojo Issues that are related to mojo label Sep 7, 2023
@Mogball
Copy link
Collaborator

Mogball commented Sep 21, 2023

Thanks for the bug report! We're still figuring out the ins and outs of how tuple support will work, especially for memory-only types.

@lattner
Copy link
Collaborator

lattner commented Dec 6, 2023

Is this fixed in 0.6?

@Mogball
Copy link
Collaborator

Mogball commented Dec 6, 2023

I don't believe so

@gabrieldemarmiesse
Copy link
Contributor

There was a more recent issue about this that I opened: #1817 . The bug is still here as of v2024.1.0. We might want to deduplicate issues and close one of those two.

@lattner
Copy link
Collaborator

lattner commented Apr 9, 2024

Fixed in the next release.

@lattner lattner closed this as completed Apr 9, 2024
@ematejska ematejska added the mojo-repo Tag all issues with this label label May 6, 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 mojo Issues that are related to mojo mojo-lang Tag for all issues related to language. mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

6 participants