Check input dimensions.