Ellipsis printing improvement ideas
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.
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.
I think we try what you propose and see what the fallout is from other users.
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?