Tensorflow.js tf.layers.maxPooling1d() Function Last Updated : 29 Mar, 2022 Comments Improve Suggest changes Like Article Like Report Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. Tensorflow.js tf.layers.maxPooling1d() function is used for max pooling operation on temporal data. Syntax: tf.layers.maxPooling1d( args ); Parameters: args: It specifies the given config object:poolSize: It is a number or array of numbers. It specifies the size of the windows to pool over.strides: It is a number or array of numbers. It specifies the period at which to sample the pooled values.padding: It should be one of these three values: 'valid', 'same', and 'casual'. It specifies how to fill in data that are not an integer multiple of poolSize. inputSize: It should be null or an array of numbers. It is used for creating the input layer to insert before these layers. batchInputShape: It should be null or an array of numbers. I defined, it as used for creating the input layer to insert before these layers. batchInputShape have more priority that inputSize, so we prefer batchInputSize over inputSize.batchSize: It should be a number. In the absence of batchInputShape, this field is used to create batchInputShape with inputShape. batchInputShape : [ batchSize , ...inputShape].dtype: If this layer is used as the input layer, then this field is used as data type for this layer.name: It should be a string type. this field defines the name for this layer.trainable: It should be boolean. This field defines whether the weights of this layer are trainable with fit or not.weights: This should be a tensor that defines the initial weight value for this layer.inputDType: This is the data- type which is used for Legacy support. Return Value: It returns MaxPooling1d. Example 1: In this example, we will add tf.layers.maxPooling1d() function to sequential model and print summary of the model. JavaScript import * as tf from "@tensorflow.js/tfjs" const model = tf.sequential(); // First layer must have a defined input shape model.add(tf.layers.maxPooling1d({ poolSize: 4, strides: 5, padding: 'valid', inputShape: [4,3] })); // Afterwards, TF.js does automatic shape inference. model.add(tf.layers.maxPooling1d({ poolSize: 4, strides: 5, padding: 'valid' })); // Printing the summary of model model.summary(); Output: __________________________________________________________________________________________ Layer (type) Input Shape Output shape Param # ========================================================================================== max_pooling1d_MaxPooling1D2 [[null,4,3]] [null,1,3] 0 __________________________________________________________________________________________ max_pooling1d_MaxPooling1D2 [[null,1,3]] [null,0,3] 0 ========================================================================================== Total params: 0 Trainable params: 0 Non-trainable params: 0 __________________________________________________________________________________________ Example 2:< In this example, we will make the maxPooling1d layer to our model and inspect the model shape. JavaScript import * as tf from "@tensorflow.js/tfjs" const model = tf.sequential(); // First layer must have a defined input shape model.add(tf.layers.maxPooling1d({ poolSize: 4, strides: 5, padding: 'valid', inputShape: [4,3] })); // Afterwards, TF.js does automatic shape inference. model.add(tf.layers.dense({units: 3})); model.add(tf.layers.maxPooling1d({ poolSize: 4, strides: 5, padding: 'valid' })); // Inspect the inferred shape of the model's output. console.log(JSON.stringify(model.outputs[0].shape)); Output: [null,0,3] Reference: https://js.tensorflow.org/api/latest/#layers.maxPooling1d Comment More infoAdvertise with us Next Article Tensorflow.js tf.layers.maxPooling1d() Function S satyam00so Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.layers.maxPooling2d() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.layers.maxPooling3d() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.layers.maximum() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or Node.js. The tf.lay 2 min read Tensorflow.js tf.maxPool3d() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.maxPool3d() function is used compute the 3D max pooling. Syntax: tf.maxPool3d (x, filterSize, strides, pad, dimRoundingMode?, d 2 min read Tensorflow.js tf.layers.minimum() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.layers.minimum() function is used to create a layer that is used to compute the element-wise minimum of an Array of inputs. It 2 min read Tensorflow.js tf.layers.multiply() Function Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment. The tf.layers.multiply() function is used to perform element-wise multiplication of an array of inputs. Syntax: tf.layers.multiply() P 2 min read Tensorflow.js tf.layers.reLU() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.layers.spatialDropout1d() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.loadLayersModel() Function Tensorflow.js is a Google-developed open-source toolkit for executing machine learning models and deep learning neural networks in the browser or on the node platform. It also enables developers to create machine learning models in JavaScript and utilize them directly in the browser or with Node.js. 2 min read Tensorflow.js tf.maxPoolWithArgmax() Function Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .maxPoolWithArgmax() function is used to determine the 2D max pooling of an image along with argmax list i.e. index 3 min read Like