Tensorflow.js tf.Sequential class .summary() Method Last Updated : 27 May, 2022 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 .summary() function in tensorflow.js is used to print a text summary in favor of the sequential model's layers. Moreover, it consists of the name as well as the type of each and every layers that include the model, the output configuration(s) of the layers, the counts of weight parameters of each and every layer, the absolute counts of trainable plus non-trainable parameters of the stated model. Syntax: summary(lineLength?, positions?, printFn?) Parameters: lineLength: It is the stated custom line length, in the list of characters. It is optional and is of type number.positions: It is the stated custom size of all the columns, like either fractions of lineLength i.e. [0.25, 0.5, 0.75] or else absolute list of characters i.e. [20, 40, 55]. Here, each and every number belongs to the closing i.e. right-hand position of the stated column. It is optional and is of type number[].printFn: It is the stated custom print function which is utilized to substitute the default value which is console.log. It is optional parameter. Return Value: It returns void. Example 1: Calling summary() method without any parameter. JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Defining model const myModel = tf.sequential(); // Calling add() method to add layers myModel.add( tf.layers.dense({units: 4, inputShape: [20], initiation: 'prelu'})); myModel.add(tf.layers.dense({units:2 , initiation: 'logSigmoid'})); // Calling summary method and // Printing output myModel.summary(); Output: _________________________________________________________________ Layer (type) Output shape Param # ================================================================= dense_Dense121 (Dense) [null,4] 84 _________________________________________________________________ dense_Dense122 (Dense) [null,2] 10 ================================================================= Total params: 94 Trainable params: 94 Non-trainable params: 0 _________________________________________________________________ Example 2: Calling summary() method with its parameters. JavaScript // Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" // Calling summary method with its // parameters and printing output tf.sequential({ layers:[tf.layers.dense({units: 7, inputShape: [6]})] }).summary({lineLength: 4}, {positiions: [1, 2, 4]}); Output: Layer (type) Output shape Param # dense_Dense189 (Dense) [null,7] 49 Total params: 49 Trainable params: 49 Non-trainable params: 0 Reference: https://js.tensorflow.org/api/latest/#tf.Sequential.summary Comment More infoAdvertise with us Next Article Tensorflow.js tf.Sequential class .summary() Method nidhi1352singh Follow Improve Article Tags : JavaScript Web Technologies Tensorflow.js Similar Reads Tensorflow.js tf.Sequential Class .add() Method 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 .add() function is used to affix a layer prototype on the topmost part of the layer stack. Syntax: add(layer) Param 2 min read Tensorflow.js tf.Sequential class .fit() Method 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.jstf.Sequential class .fit( ) method is used to train the model for the fixed number of epochs( iterations on a dataset ). 4 min read Tensorflow.js tf.Sequential class.predict() Method 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 .predict() method is used to produce the output expectations considering the stated input instances. Moreover, the 2 min read Tensorflow.js tf.Sequential class .evaluate() Method 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 .evaluate() function is used to find the measure of loss and the values of metrics in favor of the prototype in tes 3 min read Tensorflow.js tf.Sequential Class 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.Sequential class is a model of the collection of layers in stack form. These layers are connected to the respective n 2 min read Tensorflow.js tf.Sequential class .fitDataset() Method 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.Sequential class .fitDataset() method is used to trains the model using a dataset object. Syntax: model.fitDataset(da 4 min read Tensorflow.js tf.TensorBuffer Class .set() Method 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.TensorBuffer class .set() function is used to set a given value in the buffer at a specified location. Syntax: set (value, ...l 2 min read Tensorflow.js tf.Sequential class .trainOnBatch() Method 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 .trainOnBatch() function is used to run a separate gradient update on a particular batch of data. Note: This method 2 min read Tensorflow.js tf.Tensor class .print() Method 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.print() function is used to Prints information about the tf.Tensor including its data. Syntax: tf.print(value, verbose) Paramet 2 min read Tensorflow.js tf.Sequential class .evaluateDataset() Method 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 .evaluateDataset() function is used to evaluate the stated sequential model by means of a stated dataset object. No 3 min read Like