Skip to contents

Checks that shapes is a non-empty list() of valid shapes, see assert_shape().

Usage

assert_shapes(
  shapes,
  coerce = TRUE,
  named = FALSE,
  null_ok = FALSE,
  unknown_batch = NULL
)

Arguments

shapes

(list() of integer())
A list() of shapes.

coerce

(logical(1))
Whether to coerce the shapes to integer() if possible.

named

(logical(1))
Whether the shapes must be uniquely named.

null_ok

(logical(1))
Whether NULL, i.e. a wholly unknown shape, is valid.

unknown_batch

(logical(1) | NULL)
Whether the batch dimension must be unknown, i.e. NA. If left NULL (default), the first dimension can be NA or not.

Value

The shapes, coerced to integer() if coerce is TRUE.

Examples

assert_shapes(list(c(NA, 3), c(NA, 5)))
#> [[1]]
#> [1] NA  3
#> 
#> [[2]]
#> [1] NA  5
#>