Having utilized the outerProduct feature within the TensorFlow.js framework on two 1D arrays (a,b), I am faced with a challenge in obtaining the values of the produced tensor in regular JavaScript format.
Despite attempts using .dataSync and Array.from(), achieving the desired output format continues to be elusive. The anticipated outcome of the outer product calculation between the two 1D arrays should result in a 2D array, however, a 1D array is what I am receiving instead.
const a = tf.tensor1d([1, 2]);
const b = tf.tensor1d([3, 4]);
const tensor = tf.outerProduct(b, a);
const values = tensor.dataSync();
const array1 = Array.from(values);
console.log(array1);
The expected value for array1 is [ [ 3, 6 ] , [ 4, 8 ] ], but the actual result is array1 = [ 3, 6, 4, 8 ]