I have an [174,48] dimensional tensor and I would like to output all (without them being compressed in a manner similar to this values of it into the developer console present in the browser. How would I be able to achieve this?
I have an [174,48] dimensional tensor and I would like to output all (without them being compressed in a manner similar to this values of it into the developer console present in the browser. How would I be able to achieve this?
Example
const tensor = tf.tensor([[1, 2], [3, 4]]);
console.log(JSON.stringify(tensor.arraySync())); // [[1,2],[3,4]]
tensor.arraySync() creates a nested array of the tensor. JSON.stringify is then used to turn the arrays into a string before being printed to the console.
Alternatives
Alternatively, you can use tensor.dataSync(), which returns the data in a single dimension instead of a nested array.
Both functions also have a asynchronous version that do not block the UI which is especially useful for large tensors: