update output_shape logic