Skip to content
Related Articles

Related Articles

Tensorflow.js tf.signal.hannWindow() Function

Improve Article
Save Article
Like Article
  • Last Updated : 12 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. 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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!