Tensorflow: Convolutions with different filter for each sample in the mini-batch

前端 未结 4 1155
伪装坚强ぢ
伪装坚强ぢ 2021-01-05 02:31

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

4条回答
  •  半阙折子戏
    2021-01-05 02:41

    They way to go around it is adding an extra dimension using

    tf.expand_dims(inp, 0)
    

    to create a 'fake' batch size. Then use the

    tf.nn.conv3d()
    

    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.

提交回复
热议问题