Tensorflow.js tf.layers.inputLayer() Function Last Updated : 18 Aug, 2021 Comments Improve Suggest changes Like Article Like Report 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 tf.layers.inputLayer() function is an inlet point towards a tf.LayersModel. It is produced spontaneously in favor of tf.Sequentialmodels by defining the inputshape or else batchInputShape in favor of the first layer. It must not be defined particularly. Moreover, it can be beneficial periodically, for example, while creating a sequential model out of a subset of other sequential model layers. Syntax: tf.layers.inputLayer(args) Parameters: args: It is the stated arguments that the above method can hold. It is of type object and the arguments it holds are as stated below.inputShape: The stated input shape that does not include the batch axis. It can be of type (null | number)[].batchSize: It is the stated elective input batch size. It can be of type integer or null.batchInputShape: It is the stated batch input shape that includes the batch axis. It can be of type (null | number)[].dtype: The data type of the stated input. It can be of type float32, int32, bool, complex64, or string.sparse: It states if the created placeholder is intended to be sparse. It is of boolean.name: The stated name of the layer being used. It is of type string. Return Value: It returns InputLayer. Example 1: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining a model const model = tf.sequential(); // Calling layers.inputLayer() using add() method model.add(tf.layers.inputLayer({inputShape: [4]})); // Printing output model.predict(tf.ones([1, 4])).print(); Output: Tensor [[1, 1, 1, 1],] Example 2: JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining a model const model = tf.sequential(); // Calling layers.inputLayer() method using add() method model.add(tf.layers.inputLayer({batchInputShape: [4], dtype: 'int32', sparse: false, name: 'mlayer'})); // Printing output model.summary(); Output: _________________________________________________________________ Layer (type) Output shape Param # ================================================================= mlayer (InputLayer) [4] 0 ================================================================= Total params: 0 Trainable params: 0 Non-trainable params: 0 _________________________________________________________________ Reference: https://js.tensorflow.org/api/latest/#layers.inputLayer Comment More infoAdvertise with us Next Article Tensorflow.js tf.layers.inputLayer() Function nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.layers.gru() 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. Tensorflow.js tf.layers.gru() function is used to create a RNN layer which consists of only one GRUCell and the apply method of this l 2 min read Tensorflow.js tf.input() Function The models in deep learning are collections of connected Layers which can be trained, evaluate, and can be used to predict something. To perform this operation you need to instantiate an input to the models. In this post, We are going to know about how the input factory function works. The tf.input( 2 min read Tensorflow.js tf.layers.gruCell() Function Tensorflow.js is an open-source library that is being developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment. The .layers.gruCell( ) function is used to create a cell class for GRU. Syntax: tf.layers.gruCell (args) Paramete 4 min read Tensorflow.js tf.layers.gaussianDropout() 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.layers.add() 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.layers.elu() 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.layers.dot() 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. Tensorflow.js tf.layers.dot() function is used to apply the dot product between the two tensors provided. Syntax: tf.layers.dot(args) 3 min read Tensorflow.js tf.layers.rnn() 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. Tensorflow.js tf.layers.rnn() function is basically base class for recurrent layers. Syntax: tf.layers.rnn( args ); Parameters: arg 4 min read Tensorflow.js tf.initializers.ones() Function Tensorflow.js is a very well-known machine learning library that used to develop a machine learning model using JavaScript. The main purpose to use this library is to run and deploy a machine learning model directly from the browser or in Node.js. Tensorflow.js is an open-source hardware-accelerated 2 min read Tensorflow.js tf.layers.gaussianNoise() 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 Like