Open In App

Tensorflow.js tf.layers.minimum() Function

Last Updated : 21 May, 2021
Improve
Improve
Like Article
Like
Save
Share
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.

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 takes as input a list of tensors, having the same shape.

Syntax:

tf.layers.minimum (args)

Parameters:

It takes as input an object: args (Object). It is optional to provide args object as input. Following are the fields you can provide in the args object.

  • inputShape ((null or number)[]): creates an input layer that is inserted before this layer.
  • batchInputShape ((null or number)[]): has the same purpose as the above parameter but if both input shape and batchInputShape are defined, batchInputShape will be preferred.
  • batchSize (number): if both the above parameters are not specified, batch Size is used to construct the batchInputShape.
  • dtype : the data type of the layer. Eg: float32, int32, etc.
  • name (string): it is used to give a name to the layer.
  • weights (tf.Tensor[]): it provides initial weight values.
  • trainable (boolean): it is used to specify whether the weights are updatable by fit. The default value is true.

Return Value: It returns element-wise minimum.

Example 1:

Javascript




const tf = require("@tensorflow/tfjs")
  
// providing input
const x = tf.input({shape: [4, 4, 4]});
const y = tf.input({shape: [4, 4, 4]});
  
// creating required layer
const minimumLayer = tf.layers.minimum();
const minimum = minimumLayer.apply([x, y]);
console.log(minimum.shape);


Output:

[ null, 4, 4, 4 ]

Example 2:

In this example, we will provide the args object as input with the fields of name and trainable.

Javascript




const tf = require("@tensorflow/tfjs")
  
// providing input
const x = tf.input({shape: [5, 5, 5]});
const y = tf.input({shape: [5, 5, 5]});
const z = tf.input({shape: [5, 5, 5]});
  
// creating required layer
const minimumLayer = tf.layers.minimum({name:"layer1", trainable:false});
const minimum = minimumLayer.apply([x, y, z]);
console.log(minimumLayer.name)
console.log(minimumLayer.trainable)
console.log(minimumLayer.shape);


Output:

layer1
false
[ null, 5, 5, 5 ]

Reference: https://js.tensorflow.org/api/latest/#minimum



Similar Reads

Tensorflow.js tf.layers.embedding() 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 tf.layers.embedding() function is used to map positive integers into dense vectors of fixed size. Syntax: tf.layers.embedding(args)Parameters: This function accepts
3 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.layers.elu() function is abbreviated as Exponential L
2 min read
Tensorflow.js tf.layers.globalMaxPooling1d() 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. The tf.layers.globalMaxPooling1d() function is us
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); Parameters: This function accepts the following p
3 min read
Tensorflow.js tf.layers.timeDistributed() 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.timeDistributed() function is used to apply the wrap of a layer to every temporal slice of a specified input. The given input must be at least 3D, and the index 1 for the
3 min read
Tensorflow.js tf.layers.average() 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.layers.average() function is used to calculate averag
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) Parameters: recurrentActivation: It is a tensor input that
4 min read
Tensorflow.js tf.layers.thresholdedReLU() 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. The tf.layers.thresholdedReLU() function is used
2 min read
Tensorflow.js tf.layers.dense() Function
The tf.layers.dense() is an inbuilt function of Tensorflow.js library. This function is used to create fully connected layers, in which every output depends on every input. Syntax: tf.layers.dense(args)Parameters: This function takes the args object as a parameter which can have the following properties: units: It is a positive number that defines
3 min read
Tensorflow.js tf.layers.dropout() 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.dropout() function is an inbuilt function of Tensorflow.js library. This function is used to prevent overfitting in a model by randomly setting a fraction rate of input u
2 min read