assert_shapes: Assert a List of Shapes

View source: R/shape.R

assert_shapesR Documentation

Assert a List of Shapes

Description

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.

See Also

Other Shape Assertions: assert_dim_in_range(), assert_known_dims(), assert_ndim(), assert_not_batch_dim(), assert_positive_extent(), assert_same_batch_size(), assert_same_ndim(), assert_shape()

Examples

assert_shapes(list(c(NA, 3), c(NA, 5)))

mlr3torch documentation built on Oct. 30, 2026, 5:10 p.m.