| assert_same_batch_size | R Documentation |
Rejects inputs whose batch sizes, i.e. first dimensions, disagree. An unknown (NA) batch size
is compatible with any other, so only the known ones have to agree.
Unlike the other assertions this returns the common batch size rather than its input, because that is what the caller needs next: an operator that drops the batch dimension while it works has to put it back afterwards.
assert_same_batch_size(shapes, id)
shapes |
( |
id |
( |
(integer(1)) The common batch size, invisibly, or NA_integer_ if no input has a
known one.
Other Shape Assertions:
assert_dim_in_range(),
assert_known_dims(),
assert_ndim(),
assert_not_batch_dim(),
assert_positive_extent(),
assert_same_ndim(),
assert_shape(),
assert_shapes()
assert_same_batch_size(list(c(8, 3), c(8, 5)), id = "nn_block")
# an unknown batch size is compatible with a known one, which is the one that is returned
assert_same_batch_size(list(c(NA, 3), c(8, 5)), id = "nn_block")
try(assert_same_batch_size(list(c(8, 3), c(4, 5)), id = "nn_block"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.