const tf = require(
"@tensorflow/tfjs"
);
const y_true = tf.tensor2d(
[0., 1., 0., 0., 0., 0., 1.,
0., 1., 1., 0., 1.], [4, 3]
);
const y_pred = tf.tensor2d(
[1., 1., 0., 1., 0., 0., 1.,
1., 1., 0., 0., 1.], [4, 3]
);
const absolute_difference = tf.losses.absoluteDifference(
y_true, y_pred, [0.7, 0.3, 0.2])
absolute_difference.print()