(I use returnn-common code here but nothing is really specific about returnn-common. nn.zeros is just ConstantLayer.)
Consider this code:
x = nn.zeros((dim1, dim2))
x.verify_out_shape({dim1, dim2})
This is correct when dim1 and dim2 are static dims.
Once they are dynamic dims and introduce implicit dims, the verify_out_shape fails because it does not cover the implicit dims. E.g. when dim1 has a dyn_size_ext of shape [B], then currently you actually need:
x.verify_out_shape({dim1, dim2, batch_dim})
Or:
x.verify_out_shape({dim1, dim2, ImplicitDynSizeDim(batch_dim)})
Because the batch dim is an implicit dim.
Why do we have implicit dims? What are those? They were introduced mostly for CumConcatLayer. See #391, #589.
Example of such error: rwth-i6/returnn_common#226
See also the earlier discussion on the introduction of out_shape and verify_out_shape: #706, #757
(I use returnn-common code here but nothing is really specific about returnn-common.
nn.zerosis justConstantLayer.)Consider this code:
This is correct when
dim1anddim2are static dims.Once they are dynamic dims and introduce implicit dims, the
verify_out_shapefails because it does not cover the implicit dims. E.g. whendim1has adyn_size_extof shape[B], then currently you actually need:Or:
Because the batch dim is an implicit dim.
Why do we have implicit dims? What are those? They were introduced mostly for
CumConcatLayer. See #391, #589.Example of such error: rwth-i6/returnn_common#226
See also the earlier discussion on the introduction of
out_shapeandverify_out_shape: #706, #757