print.tidytensor.Rd
Prints a summary of a tidytensor as a nested hierarchy of tensors of lower rank.
# S3 method for tidytensor
print(
x,
show_dimnames = FALSE,
max_per_level = 1,
base_rank = NULL,
max_rows = 6,
max_cols = 6,
max_depth = 3,
signif_digits = 3,
indent = 0,
...
)
a tidytensor to summarize.
show the dimension names, if present, or dimension indices if not in base-level prints.
only show this many sub-tensors per level.
either NULL, 1, 2, or 3 - specifies whether the inner/bottom-most tensors should be represented as rank 1, 2, or 3 in a grid (NULL for autodetect based on tensor shape, see details).
limit the base-level prints to include this many rows (also applies to 1d prints).
limit the base-level prints to include this many columns.
in 3d representation, limit the base-level prints to include this many entries of the last rank.
number of significant digits to print for numeric tensors.
indent the printout by this much (used internally).
additional arguments to be passed to or from methods (ignored).
The base_rank
argument specifies whether the lowest ranks of the tensor (displayed as a grid) should be shown as rank 2 tensors, rank 3 tensors, or rank 1 tensors; the default of NULL
will
select 3 if the last rank is of size 3 or 1 (assuming an image and a "channels-last" convention), 2 if the 3rd-to-last rank is length 3 or 1 (assuming an image
and a "channels-first" convention) or if there are only two ranks or if the last two ranks are equal (assuming an image channel of some kind), and otherwise will default to 1.
max_per_level
indicates how many replicates
print.tidytensor
t <- as.tidytensor(array(1:(2 * 3 * 4 * 5), dim = c(2, 3, 4, 5)))
ranknames(t) <- c("samples", "batches", "rows", "cols")
print(t, base_rank = 2)
#> # Rank 4 tensor, shape: (2, 3, 4, 5), ranknames: samples, batches, rows, cols
#> | # Rank 3 tensor, shape: (3, 4, 5)
#> | | # Rank 2 tensor, shape: (4, 5)
#> | | 1 25 49 73 97
#> | | 7 31 55 79 103
#> | | 13 37 61 85 109
#> | | 19 43 67 91 115
#> | | # ...
#> | # ...
t <- as.tidytensor(array(1:(2 * 3 * 40 * 50 * 3), dim = c(2, 3, 40, 50, 3)))
ranknames(t) <- c("sample", "batch", "row", "pixel", "channel")
print(t, max_rows = 6, max_cols = 6, max_depth = 3, show_dimnames = TRUE, base_rank = 3)
#> # Rank 5 tensor, shape: (2, 3, 40, 50, 3), ranknames: sample, batch, row, pixel, channel
#> | # Rank 4 tensor, shape: (3, 40, 50, 3)
#> | | # Rank 3 tensor, shape: (40, 50, 3)
#> | | [,1,] [,2,] [,3,] [,4,] [,5,] [,6,] ...
#> | | [1,,] [1, 12000, 24000] [241, 12200, 24200] [481, 12500, 24500] [721, 12700, 24700] [961, 13000, 25000] [1200, 13200, 25200] ...
#> | | [2,,] [7, 12000, 24000] [247, 12200, 24200] [487, 12500, 24500] [727, 12700, 24700] [967, 13000, 25000] [1210, 13200, 25200] ...
#> | | [3,,] [13, 12000, 24000] [253, 12300, 24300] [493, 12500, 24500] [733, 12700, 24700] [973, 13000, 25000] [1210, 13200, 25200] ...
#> | | [4,,] [19, 12000, 24000] [259, 12300, 24300] [499, 12500, 24500] [739, 12700, 24700] [979, 13000, 25000] [1220, 13200, 25200] ...
#> | | [5,,] [25, 12000, 24000] [265, 12300, 24300] [505, 12500, 24500] [745, 12700, 24700] [985, 13000, 25000] [1220, 13200, 25200] ...
#> | | [6,,] [31, 12000, 24000] [271, 12300, 24300] [511, 12500, 24500] [751, 12800, 24800] [991, 13000, 25000] [1230, 13200, 25200] ...
#> | | ... ... ... ... ... ... ... ...
#> | | # ...
#> | # ...