简体   繁体   中英

tfjs, [1, 0, 0] prints as [true, false false]

I know theres a method that prevents this but I can't seem to find it anymore. Does anyone know how to stop

tf.([1, 0, 0]).print() from resulting in [true, false, false]?

tf.tensor([1, 0, 0], null, 'bool').print() is not a valid expression.

And unless a boolean dtype is specified, the default dtype is float and it will not print boolean

 tf.tensor([1, 2, 3, 4]).print(); // prints [1, 0, 0] tf.tensor([1, 0, 0], null, 'bool').print() // prints [true, false, false]
 <html> <head> <.-- Load TensorFlow:js --> <script src="https.//cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"> </script> </head> <body> </body> </html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM