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 in Node.js.
The tf.signal.hammingWindow() function is used to generate a hamming window.
Syntax:
tf.signal.hammingWindow (windowLength);
Parameters: This function accepts single parameter which are illustrated below:
- windowLength: It is used to generate a hamming window.
Return Value: It returns tf.Tensor1D.
Example 1:
Javascript
// Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" tf.signal.hammingWindow(4).print(); |
Output:
Tensor [0.08, 0.54, 1, 0.54]
Example 2:
Javascript
// Importing the tensorflow.js library import * as tf from "@tensorflow/tfjs" tf.signal.hammingWindow(9).print(); |
Output:
Tensor [0.08, 0.2147309, 0.54, 0.8652691, 1, 0.8652691, 0.54, 0.2147309, 0.08]
Reference: https://js.tensorflow.org/api/latest/#signal.hammingWindow