Tensorflow.js tf.Sequential class .summary() 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 .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.
summary(lineLength?, positions?, printFn?)
- 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.
_________________________________________________________________ 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.
Layer (type Output shap Param # dense_Dense189 (Dense [null,7 49 Total params: 49 Trainable params: 49 Non-trainable params: 0