Closed pietroppeter closed 2 years ago
Unfortunately 4D display on a 2D screen is a bit hard. Ideally 4D display looks like that https://github.com/mratsim/Arraymancer/issues/5#issuecomment-751852128
I try to reverse engineer the Haskell code of that library but got lost in Monads :/.
Regarding nimib, you might want to have a chat with @haxscramper as he also wanted to help tackle that part (and many others tooling issues like nimble dependencies resolution), https://github.com/haxscramper/haxdoc
Since #509 (and some fixes of it after) the first example now gives:
import arraymancer, sequtils
echo toSeq(1..24).toTensor().reshape(2,3,4)
Tensor[system.int] of shape "[2, 3, 4]" on backend "Cpu"
0 1
|1 2 3 4| |13 14 15 16|
|5 6 7 8| |17 18 19 20|
|9 10 11 12| |21 22 23 24|
and the second:
import arraymancer, sequtils
echo toSeq(1..16).toTensor().reshape(2,2,2,2)
Tensor[system.int] of shape "[2, 2, 2, 2]" on backend "Cpu"
0 1
0 |1 2| |5 6|
|3 4| |7 8|
---------------------
0 1
1 |9 10| |13 14|
|11 12| |15 16|
---------------------
I'll close the issue for now. If I'm missing something that is still broken, feel free to reopen.
example (playground):
output:
The two issues are:
"
after tensor shape|
in first columnsFirst one is a trivial fix (source); the second one might be a little be more involved (source), but I could try to produce a PR with a fix for both.
Also, not sure what should be the expected display of a 4d tensor, an example:
output:
I noticed these two issues while writing a remake of the Tutorial using a library I am developing: nimib.
I also noticed this very interesting issue #488 which is relevant to documentation and for which maybe nimib in the future (I am close to first release of 0.1) might be able to help with.