Open In App

Tensorflow.js tf.signal.hannWindow() Function

Last Updated : 12 May, 2021
Comments
Improve
Suggest changes
Like Article
Like
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. 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.hannWindow() function is used to generate a hann window.

Syntax:

tf.signal.hannWindow (windowLength)

Parameters: This function accepts single parameter which are illustrated below:

  • windowLength: It is used to generate a Hann window.

Return Value: It returns the tf.Tensor1D.

Example 1:

JavaScript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"

tf.signal.hannWindow(9).print();


Output:

Tensor
   [0, 0.1464466, 0.5, 0.8535534, 1, 0.8535534, 0.5, 0.1464466, 0]

Example 2:

JavaScript
// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"

tf.signal.hannWindow(3).print();


Output:

Tensor
   [0, 1, 0]

Reference: https://js.tensorflow.org/api/latest/#signal.hannWindow


Next Article

Similar Reads