0

I'm creating a SSL neural network and my input tensor is a NxM tensor where N is the length of the sound wave and M is the number of microphones. The actual size is roughly 14000x4

I need to pool, but I only want to pool the rows for each column (not the columns together). For example:

Pool(2)(tensor) --> tensor of size (N/2)xM

Is this possible without splitting the tensor into 4 tensors, preforming 4 separate Pool1D, then concatenating?

Pool1D gives dimensionality error Pool2D reduces the number of rows and columns

a_person
  • 21
  • 2

1 Answers1

1

Set the stride to 1 for the columns,

tf.keras.layers.MaxPooling2D(pool_size=(2, 2),strides=(2, 1), padding='same')

Example,

inputs = tf.random.normal(shape=(14000,4)) 
inputs = inputs[None,...,None] 
max_pool_2d = tf.keras.layers.MaxPooling2D(pool_size=(2, 2),strides=(2, 1), padding='same') 
max_pool_2d(inputs).shape
#[1, 7000, 4, 1]
Vijay Mariappan
  • 16,921
  • 3
  • 40
  • 59