与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)作用相同
本文介绍了一维全局最大池化层(max_pool_1d)在TensorFlow中的使用方法,该层接受三维数据作为输入,并通过示例展示了其与tf.math.reduce_max函数在特定轴上操作的等效性。
9424

被折叠的 条评论
为什么被折叠?



