Mark Yoon
Mark Yoon

Reputation: 380

Reducing dimension of Tensor by pooling [Tensorflow]

I'm trying to construct a neural network architecture with Tensorflow.

and I have a variable, type of Tensor.

Say,

a = <tf.Tensor shape(16, ?, 20) dtype=float32>

16 is batch size and an input is encoded into dimension of 20. but, there are different number of inputs.

Here, how can I change its dimension to (16, 20) by just mean pooling with respect of the second dimension which has different size.

Thank you.

Upvotes: 1

Views: 586

Answers (1)

weitang114
weitang114

Reputation: 1303

reduce_mean?

a = tf.placeholder('float32', shape=(16, None, 20))
b = tf.reduce_mean(a, axis=1)
print b

output:

Tensor("Mean:0", shape=(16, 20), dtype=float32)

Upvotes: 3

Related Questions