Tensorflow.js tf.squaredDifference() Function
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.
The tf.squaredDifference() function is used to return (a – b) * (a – b) element-wise, where “a” is the first specified tensor and “b” is the second tensor. It Supports broadcasting.
Parameters: This function accepts two parameters which are illustrated below:
- a: The first specified tensor.
- b: The second specified tensor. It must have same data type as “a”.
Return Value: It returns (a – b) * (a – b) element-wise, where “a” is the first specified tensor and “b” is the second tensor.
Tensor [0, 1, 16, 9]
Tensor [9, 1, 4, 9]