# How to implement a (3 + 2)-dimensional convolutional layer where the 2d space is "internal"?

I am trying to train a CNN to learn 5D (kind of) data. The data is structured as follows. It has three spatial dimensions [x, y, z], but it also has two "internal dimensions" [theta, phi] at each [x, y, z]. What I am trying to do is upsample the internal space from fewer [theta, phi] data points.

When I train a 2d residual network with random [x, y, z] points in just the internal space it learns -- but there is some noise in the x, y, z space, there should be a correlation with neighbouring points.

What I wanted was some way to also include convolutions over the 3D [x, y, z] space to try and remedy this.

A possible but maybe naive approach is to do the following: Stack the images as [theta * phi, x, y, z] (so, many input channels) and then have some 3d convolution layers, then after that stack as [x * y * z, theta, phi] and take 2d convolutions in the internal space.

Another approach is to use 5d filters that span over all dimensions. This might be hard to implement for me and probably very memory hungry.

Are there any other ways?

• Tough problem you are tackling there. I approve your first approach and that's what I would try. 5D convolutions seems weird. And I can't think of any other way. May 26 at 13:10
• Any suggestions on how the separate 2d and 3d convolution should be implemented? Like should they be parallel in unconnected blocks or should it be do 2d first and then do 3d or vice versa.
– play
May 26 at 15:35
• I would use them one after the other as using them in parallel changes the dimensions and thus makes it complicated to concatenate / sum afterwards. May 26 at 20:28