Skip to content
Related Articles

Related Articles

Tensorflow.js tf.env() Function

Improve Article
Save Article
  • Last Updated : 14 Aug, 2021
Improve Article
Save Article

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

The .env() function is used to return the present environment i.e. a global entity. Moreover, the environment object includes the assessed attribute values along with the dynamic platform.

Syntax:

tf.env() 

Parameters: This method do not holds any parameter.

Return Value: It returns tf.Environment.

Example 1:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Calling env() and getBool() method
// along with its parameter
const res = tf.env().getBool('WEBGL_RENDER_FLOAT32_ENABLED');
  
// Printing output
console.log(res);


Output:

true

Example 2:

Javascript




// Importing the tensorflow.js library
import * as tf from "@tensorflow/tfjs"
  
// Calling env() method's feature
const res1 = tf.env().features;
  
// Printing output
console.log(res1);


Output:

{
  "WEBGL_FORCE_F16_TEXTURES": false,
  "WEBGL_VERSION": 2,
  "WEBGL_RENDER_FLOAT32_CAPABLE": true,
  "WEBGL_RENDER_FLOAT32_ENABLED": true,
  "PROD": true,
  "DEBUG": true
}

Reference: https://js.tensorflow.org/api/latest/#env

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!