Sunday, November 17, 2024
Google search engine
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

Recent Comments