I'm trying to print a tensor I got using tf.fromPixels
for debugging purposes. But because the tensor is too big just doing
a = tf.fromPixels(image, 3);
a.print();
doesn't work, because it is being shortened in the console. Is there a workaround for this?
If you really only want the values you can use .data()
or .dataSync()
to download all values as a one dimensional TypedArray:
console.log(a.dataSync());
but since your Tensor actually represents an image you can show it visually in a <canvas>
element:
tf.toPixels(a, document.getElementsByTagName("canvas")[0]);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With