Issue
I have the following parameters defined for doing a max pool over the depth of the image (rgb) for compression before the dense layer and readout...and I am failing with an error that I cannot pool over depth and everything else:
sunset_poolmax_1x1x3_div_2x2x3_params = \
{'pool_function':tf.nn.max_pool,
'ksize':[1,1,1,3],
'strides':[1,1,1,3],
'padding': 'SAME'}
I changed the strides to [1,1,1,3]
so that depth is the only dimension reduced by the pool...but it still doesn't work. I can't get good results with the tiny image I have to compress everything to in order to keep the colors...
Actual Error:
ValueError: Current implementation does not support pooling in the batch and depth dimensions.
Solution
tf.nn.max_pool does not support pooling over the depth dimension which is why you get an error.
You can use a max reduction instead to achieve what you're looking for:
tf.reduce_max(input_tensor, reduction_indices=[3], keep_dims=True)
The keep_dims
parameter above ensures that the rank of the tensor is preserved. This ensures that the behavior of the max reduction will be consistent with what the tf.nn.max_pool operation would do if it supported pooling over the depth dimension.
Answered By - Benoit Steiner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.