Tensorflow.js tf.setBackend() Function
The tf.setBackend() function is used to set the current backend name.
tf.setBackend( backendName )
- backendName: The name of the backend.
Return Value: It returns Promise <boolean>
Example 1: In this example, we have set the backend to string “cpu”. Then it’s set to string “webgl” and the backend is removed returning “null” string.
Example 2: In this example, we have set the backend to string “cpu”. The backend is removed returning a “null” in the console. We set the backend to “webgl” returning backend as string “webgl”.