Skip to content
Related Articles

Related Articles

Improve Article

Tensorflow.js tf.util.now() Function

  • Last Updated : 21 May, 2021

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :