I would like to reduce the dimensions of input vectors by a similar procedure like average pooling. The inputs are some vectors of length K*L, and I want to reduce their dimensions by taking the average every L entries to form vectors of length K. I tried to use functions like tf.layers.average_pooling1d and tf.nn.avg_pool but the input of a 4-D or 3-D tensor is required for these functions are designed to deal with images. I cannot figure out the meaning of channels in my case. I tried to simply add a dimension as channel but errors were reported even in the previous fully-connected layers. I was wondering whether it is possible to do this with similar functions or use a customized function. If I haven't made myself clear, please refer to the codes below.
x = tf.placeholder(tf.float32, [None, N])
layer_out = tf.contrib.layers.fully_connected(x, K * L)
layer_out = tf.layers.average_pooling1d(layer_out, L, L)
output = tf.contrib.layers.softmax(layer_out)
It basically stretches the vectors of length N to K*L and then compressed them to length L.