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.
- layer: It is the stated prototype of layer and it is of type tf.layers.Layer.
Return Value: It returns void.
Output: Here, layers.dense() method is utilized to generate a entirely dense layer, predict() method is used to produce output forecasts in favor of input instances, and truncatedNormal() method is used to produce a tf.Tensor with the help of values that are sampled from a normal distribution that is truncated.
Tensor [[0.1687946 ], [-0.1382875], [-0.3894148], [0.1748937 ]]
Output: Here, layers.maxpooling2d() method is helpful in max pooling task by means of spatial data, predictOnBatch() method is used to forecast in favor of a particular group of instances, and randomNormal() method is utilized in producing tf.Tensor with the help of values that are sampled from a normal distribution.
Tensor [[[[0.9905863, 1.6736914, -1.2367558, -0.3343732], [0.2533375, 0.5539166, 0.6961272 , -0.3252741]]]]