Returns the mod of a and b element-wise. floor(x / y) * y + mod(x, y) = x Supports broadcasting.
floor(x / y) * y + mod(x, y) = x
We also expose tf.modStrict which has the same signature as this op and asserts that a and b are the same shape (does not broadcast).
tf.modStrict
a
b
const a = tf.tensor1d([1, 4, 3, 16]);const b = tf.tensor1d([1, 2, 9, 4]);a.mod(b).print(); // or tf.mod(a, b) Copy
const a = tf.tensor1d([1, 4, 3, 16]);const b = tf.tensor1d([1, 2, 9, 4]);a.mod(b).print(); // or tf.mod(a, b)
// Broadcast a mod b.const a = tf.tensor1d([2, 4, 6, 8]);const b = tf.scalar(5);a.mod(b).print(); // or tf.mod(a, b) Copy
// Broadcast a mod b.const a = tf.tensor1d([2, 4, 6, 8]);const b = tf.scalar(5);a.mod(b).print(); // or tf.mod(a, b)
The first tensor.
The second tensor. Must have the same type as a.
Generated using TypeDoc
Returns the mod of a and b element-wise.
floor(x / y) * y + mod(x, y) = x
Supports broadcasting.We also expose
tf.modStrict
which has the same signature as this op and asserts thata
andb
are the same shape (does not broadcast).