0
最初のコードを参照してください。なぜout_channelsはtf.nn.separable_conv2dのパラメータであるpointwise_filterのchannel_multiplier * in_channelsよりも大きい必要がありますか?
import tensorflow as tf
import numpy as np
input_data = tf.Variable(np.random.rand(10,9,9,3), dtype=np.float32)
#depthwise_filter (filter_height, filter_width, in_channels, channel_multiplier)
depthwise_filter = tf.Variable(np.random.rand(2,2,3,5), dtype=np.float32)
#pointwise_filter (1, 1, channel_multiplier * in_channels, out_channels)
pointwise_filter = tf.Variable(np.random.rand(1,1,15,8), dtype=np.float32)
y = tf.nn.separable_conv2d(input_data, depthwise_filter, pointwise_filter, strides=[1,1,1,1], padding='SAME')
print(tf.shape(y))
エラー:
Traceback (most recent call last):
File "tsfl.py", line 36, in <module>
y = tf.nn.separable_conv2d(input_data, depthwise_filter, pointwise_filter, strides=[1,1,1,1], padding='SAME')
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\nn_impl.py", line 486, in separable_conv2d
channel_multiplier * in_channels, out_channels))
ValueError: Refusing to perform an overparameterized separable convolution: channel_multiplier * in_channels = 5 * 3 = 15 > 8 = out_channels
channel_multiplier * in_channels < = out_channels、それが動作します。
なぜout_channelsがchannel_multiplier * in_channelsよりも大きい必要がありますか?