Saturday, November 15, 2025
HomeLanguagesJavascriptTensorflow.js tf.util.now() Function

Tensorflow.js tf.util.now() Function

Tensorflow.js is an open-source library which is being develop by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.

The .util.now() function is used to find the present time in milliseconds which is of high resolution and is relative to an inconsistent time in the past. Moreover, it operates through various platforms namely node.js, browsers.

Syntax:  

tf.util.now()

Parameters:  

It does not accepts any parameter.

Return Value: It returns number.

Example 1:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Calling tf.util.now() method and
// printing output
console.log(tf.util.now());


Output:

1106999.345

Example 2:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Calling tf.sin() and  tf.util.now() 
// methods
var res = (tf.sin(tf.util.now()));
  
// printing output
console.log(res);


Output:

Tensor
    0.6055543422698975

Reference: https://js.tensorflow.org/api_node/2.0.1/#util.now

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11917 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11984 POSTS0 COMMENTS
Shaida Kate Naidoo
6890 POSTS0 COMMENTS
Ted Musemwa
7143 POSTS0 COMMENTS
Thapelo Manthata
6838 POSTS0 COMMENTS
Umr Jansen
6840 POSTS0 COMMENTS