I would like to have a 2d convolution with a filter which depends on the sample in the mini-batch in tensorflow. Any ideas how one could do that, especially if the number of sample per mini-batch is not known?
Concretely, I have input data
MB x H x W x Channels
MB x fh x fw x Channels x OutChannels
inp = tf.placeholder('float', [None, H, W, channels_img], name='img_input')
tf.nn.conv2d(inp, F, strides = [1,1,1,1])
They way to go around it is adding an extra dimension using
to create a 'fake' batch size. Then use the
operation where the filter-depth matches the batch size. This will result in each filter convolving with only one sample in each batch.
Sadly, you will not solve the variable batch size problem this way, only the convolutions.