I am trying to reshape the output of a keras Conv3D layer with 10 kernels (output_dim = (None, 14, 14, 3, 10)) to a desired outptut of (None, 14, 14, 30, 1) so I can perform another 3D convolution on all the kernels combined. I want to preserve the spatial relation / order of the previous 10 kernels in the reshaped tensor, like pasting them 'behind' each other.
Since keras.layers.reshape uses 'row-major c-style' for reshaping tensors, I would loose order of kernels here. There readily exists a comprehensive explanation on how to use numpy.reshape with numpy.permutate for numpy matrices, and assume keras will work similarly since I can also use keras.layers.permutate. The problem is, I can simply not get my head around what permutation I need in this case before reshaping with keras.layers.reshape to I preserve the order.
Intuition and idea behind reshaping 4D array to 2D array in NumPy
I could always slice and concatenate the tensor, but this would require more keras.layers and slows down my program. A 'fancy' combination of keras.layers.Permutate() --> keras.layers.Reshape() would be very much appreciated!