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

Ellipsis printing improvement ideas #66

Open
harold opened this issue Oct 3, 2022 · 3 comments
Open

Ellipsis printing improvement ideas #66

harold opened this issue Oct 3, 2022 · 3 comments
Milestone

Comments

@harold
Copy link
Collaborator

harold commented Oct 3, 2022

The ellipsis printing of tensors is great, and makes repl programming with dtype-next a lot of fun.

In the last week I had an idea for some possible improvements.

Right now, these two tensors produce the same abbreviated repl output:

> (dtt/new-tensor [1000 2000] :datatype :uint8)
#<tech.v3.tensor_api.DirectTensor@693312f7 #tech.v3.tensor<uint8>[1000 2000]
[[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]>

> (dtt/new-tensor [2000 1000] :datatype :uint8)
#<tech.v3.tensor_api.DirectTensor@f7d0146 #tech.v3.tensor<uint8>[2000 1000]
[[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]>

My first idea is something like this, but there could be better ideas for the formatting:

> (dtt/new-tensor [1000 2000] :datatype :uint8)
#<tech.v3.tensor_api.DirectTensor@693312f7 #tech.v3.tensor<uint8>[1000 2000]
[[0 0 0 ... (1994) ... 0 0 0]
 [0 0 0 ... (1994) ... 0 0 0]
 [0 0 0 ... (1994) ... 0 0 0]
 ... (994) ...
 [0 0 0 ... (1994) ... 0 0 0]
 [0 0 0 ... (1994) ... 0 0 0]
 [0 0 0 ... (1994) ... 0 0 0]]>

> (dtt/new-tensor [2000 1000] :datatype :uint8)
#<tech.v3.tensor_api.DirectTensor@f7d0146 #tech.v3.tensor<uint8>[2000 1000]
[[0 0 0 ... (994) ... 0 0 0]
 [0 0 0 ... (994) ... 0 0 0]
 [0 0 0 ... (994) ... 0 0 0]
 ... (1994) ... 
 [0 0 0 ... (994) ... 0 0 0]
 [0 0 0 ... (994) ... 0 0 0]
 [0 0 0 ... (994) ... 0 0 0]]>

In particular I think this could be helpful for downstream select and transpose operations to set up the tensor for different types of processing and consumption. For my specific case I resorted to doing some nth and count calls and some guess and check to get a convenient shape for the next consumer in my pipeline.

@cnuernber
Copy link
Owner

They aren't totally the same as the tensor shape is output on the first line. But I still think this would be a great improvement as then the counts are inline with your eye. My concern is that (994) could be interpreted as a value in the tensor balanced against your original issue.

@cnuernber
Copy link
Owner

I think we try what you propose and see what the fallout is from other users.

@harold
Copy link
Collaborator Author

harold commented Dec 16, 2022

I see, ya, it's a little tougher if they aren't all zeros. I wonder how to make the elided counts stick out more?

@cnuernber cnuernber added this to the 10.000 milestone Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants