parse_shape | R Documentation |
Use underscore to skip the dimension in parsing.
parse_shape(x, expr, ...)
x |
tensor of any supported framework |
expr |
character of length 1, space separated names for axes, underscore means skip axis |
... |
additional arguments passed to methods |
named list, maps axes names to their lengths
if (requireNamespace("abind", quietly = TRUE)) {
# Use underscore to skip the dimension in parsing.
x <- array(0, dim = c(2, 3, 5, 7))
parse_shape(x, 'batch _ h w')
# `parse_shape` output can be used to specify axes_lengths for other
# operations:
y <- array(0, dim = 700)
shape_info <- parse_shape(x, 'b _ h w')
# rearrange(y, '(b c h w) -> b c h w', shape_info) would give shape
# (2, 10, 5, 7)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.