Thanks for the suggestion, this does solve my issue in the case where I want to restrict dimensions, but not when I want to extend them. (i added an additional example to clarify my post)
Perhaps it is not a good idea to freely reshape the last dimensions since it might be ambiguous? Haven’t really thought about it.