Tensorflow.js tf.initializers.zeros() Function
Last Updated :
25 Jul, 2021
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 tf.initializers.zeros() function is an initializer that is used to produce tensors that are initialized to zero.
Syntax:
tf.initializers.zeros()
Parameters: This method does not accept any parameter.
Return Value: It returns zeros.
Example 1:
Javascript
import * as tf from "@tensorflow/tfjs"
const initializer = tf.initializers.zeros();
console.log(JSON.stringify(+initializer));
|
Output:
null
Example 2:
Javascript
import * as tf from "@tensorflow/tfjs"
const initializer = tf.initializers.zeros();
const x = initializer.shape = [ [1, 2], [3, 5]];
const y = initializer.dtype = 'int32' ;
console.log(initializer);
console.log(JSON.stringify(+initializer));
|
Output:
{
"shape": [
[
1,
2
],
[
3,
5
]
],
"dtype": "int32"
}
null
Reference: https://js.tensorflow.org/api/latest/#initializers.zeros
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...