what is the mean flatten all dimensions except batch in CNN .

It changes the shape of `x`

, from a multidimensional tensor with a shape that includes batch size, number of channels, width and height (e.g. [64, 3, 240, 480] to a tensor that has 2 dimensions where the first is batch the the second is everything else (e.g. [64, 345600]).

2 Likes

Yeah adding up to comment, you convert the remaining dimensions in a 1D array, so that you now have all red values followed by green and blue, or whichever order, but this order in which the data is flattened is deterministic / always the same, for the same arrange of input channels and dimensions, of course.