Skip to contents

Rejects inputs that do not all have the same number of dimensions, which the operators that combine several inputs require: shorter shapes are not left-padded with 1s, because the first dimension is the batch dimension.

Usage

assert_same_ndim(shapes, id)

Arguments

shapes

(list() of integer())
The input shapes.

id

(character(1))
The id of the PipeOp, which the error message names.

Value

The shapes, invisibly.

Examples

assert_same_ndim(list(c(NA, 3), c(NA, 5)), id = "nn_merge_cat")
try(assert_same_ndim(list(c(NA, 3), c(NA, 5, 2)), id = "nn_merge_cat"))
#> Error : PipeOp 'nn_merge_cat' requires all its inputs to have the same number of dimensions, but got the shapes [(NA,3);(NA,5,2)] (with 2, 3 dimensions).