VOOZH about

URL: https://www.geeksforgeeks.org/javascript/tensorflow-js-tf-min-function/

⇱ Tensorflow.js tf.min() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Tensorflow.js tf.min() Function

Last Updated : 18 May, 2021

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.min() function is used to calculate the minimum value from the specified Tensor across its dimension. It reduces the given input elements along the dimensions of axes. If the parameter "keepDims" is true, the reduced dimensions are retained with length 1 else the rank of Tensor is reduced by 1. If the axes parameter has no entries, it returns a Tensor with a single element with all reduced dimensions.

Syntax:

tf.min (x, axis?, keepDims?)

Parameters: This function accepts three parameters which are illustrated below:

  • x: The input tensor for which minimum value is being computed.
  • axis: The specified dimension(s) to reduce. By default it reduces all dimensions. It is optional parameter.
  • keepDims: If this parameter value is true, it retains reduced dimensions with length 1 else the rank of Tensor is reduced by 1. It is also optional parameter.

Return Value: It returns a Tensor of minimum value.

Example 1:

Output:

Tensor
 0
Tensor
 3
Tensor
 2

Example 2:

Output:

Tensor
 0
Tensor
 [[2, 5],]
Tensor
 2
Tensor
 [2, 5]
Reference:https://js.tensorflow.org/api/latest/#min
Comment
Article Tags: