// Importing the tensorflow.Js library
import * as tf from "@tensorflow/tfjs"
// Creating labels tensor
const a = tf.tensor2d([
[1, 4, 5, 5, 5, 7],
[4, 7, 6, 8, 9, 4]
]);
// Creating predictions tensor
const b = tf.tensor2d([
[3, 2, 5, 3, 2, 7],
[3, 5, 7, 2, 4, 5]
]);
// Computing cosine distance
cosine = tf.losses.cosineDistance(a, b , 1)
cosine.print();