# Tensorflow.js tf.sqrt() Function

• Last Updated : 10 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.sqrt() function is used to return the square root of the specified tensor’s element.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Syntax:

`tf.sqrt( x )`

Parameters: This function accept single parameter which is illustrated below:

• x: The specified input tensor.

Return Value: It returns the square root of the specified tensor’s element.

Example 1:

## Javascript

 `// Importing the tensorflow.js library``import * as tf from ``"@tensorflow/tfjs"`` ` `// Initializing a tensor of some elements``const x = tf.tensor1d([4, 9, 16, 25]);`` ` `// Calling the .sqrt() function over``// the above tensor as its parameter``x.sqrt().print();`

Output:

```Tensor
[2, 3, 4, 5]```

Example 2:

## Javascript

 `// Importing the tensorflow.js library``import * as tf from ``"@tensorflow/tfjs"`` ` `// Using a tensor of some elements``// as the parameter for the .sqrt() function``tf.tensor1d([0, 1, 2, 1.7, 2.5]).sqrt().print();`

Output:

```Tensor
[0, 1, 1.4142135, 1.3038405, 1.5811388]```
My Personal Notes arrow_drop_up