Tensorflow.js tf.mod() 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.mod() function returns element-wise remainder of division.
Operation: floor(x / y) * y + mod(x, y) = x.
Note: It supports broadcasting.
Parameters: This function accepts three parameters which are illustrated below:
- x: It is a Tensor.
- y: It is a Tensor. It must be of the same type as x.
Return Value: A Tensor. Has the same type as x.
Example 1: We also expose tf.mod() which has the same signature as this operation and asserts that a and b have the same shape (does not broadcast).
Tensor [1, 0, 3, 0, 1]
Example 2: The simplest broadcasting example when an array and a scalar value are combined in an operation:
Tensor [2, 4, 0, 3]