Tensorflow.js tf.removeBackend() Function
Last Updated :
27 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. It also helps the developers to develop ML models in JavaScript language and can use ML directly in the browser or in Node.js.
The tf.removeBackend() function is used to remove the backend and the registered factory as well.
Syntax:
tf.removeBackend(name)
Parameters:
- name: The name of the backend which we want to remove.
Return Value: It returns void
Example 1:
Javascript
tf.setBackend( "cpu" )
console.log(tf.getBackend())
tf.removeBackend( 'cpu' )
console.log(tf.getBackend())
|
Output:
cpu
null
Example 2: In this example, we have set the backend to “cpu” and then removed it and set it to “webgl”.
Javascript
tf.setBackend( "cpu" )
tf.removeBackend( 'cpu' )
console.log(tf.getBackend())
tf.setBackend( "webgl" )
console.log(tf.getBackend())
|
Output:
null
webgl
Reference: https://js.tensorflow.org/api/latest/#removeBackend
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...