与tf.keras.layers.Conv1D的输入一样,输入一个三维数据(batch_size,feature_size,output_dimension)
x = tf.constant([[1., 2., 3.], [4., 5., 6.]])
x = tf.reshape(x, [2, 3, 1])
max_pool_1d=tf.keras.layers.GlobalMaxPooling1D()
max_pool_1d(x)
其中max_pool_1d(x)和tf.math.reduce_max(x,axis=-2,keepdims=False)作用相同