บทความ

กำลังแสดงโพสต์จาก กันยายน, 2018

tensorflow การติดตั้งใหม่

-m pip install --ignore-installed --upgrade tensorflow-gpu --user

python pip list ดูว่า ใช้ pip ติดตั้งอะไรไปบ้างแล้วในเครื่อง

py -m pip list

tensorflow : คำสั่งดูว่าในเครื่องมีอุปกรณ์อะไรที่ใช้ run tensorflow

>>> from tensorflow.python.client import device_lib >>> print(device_lib.list_local_devices())

python pip ค้นหา package ด้วย search

ตัวอย่าง py -m pip search pgmagick

tensorflow : แก้ปัญหาโปรแกรมค้าง เมื่ออ่านไฟล์ tfrecords

https://stackoverflow.com/questions/45732826/tensorflow-freezes-on-session-run-when-reading-data-from-tf-records

tensorflow : สั่ง print จากภายใน graph

ใช้ tf.Print( ) <-- ใช้ตัวพิมพ์ใหญ่นะเออ (ถูก deprecated ไปแล้ว ) https://towardsdatascience.com/using-tf-print-in-tensorflow-aa26e1cff11e ตัวอย่างการใช้ p = tf.constant(...) p = tf.Print( p ,[tf.constant( 'hi' ), ..., ...]) มันจะเป็นเหมือนๆ จุดตัดระหว่างเส้นเชื่อม node p ที่ส่งเข้าไปให้มัน มันก็จะโยนออกมาโดยไม่ได้ประสนใจอะไร เหมือนเอา Print มาวางขวางเส้นเชื่อม node ซึ่งจะไม่ได้แสงผลอะไร หากต้องการแค่แสดงค่าออกมาเฉยๆ ก็อาจจะใช้คำสั่ง tf.Print(0, ["Hello"]) ส่วนที่สองคือค่าที่จะแสดงออกมาจะอยู๋ในรูปแบบ [ ] ซึ่งสามารถแสดงหลายๆค่าพร้อมๆกันออกมา สิ่งที่ใช้แทน tf.Print() คือ tf.print() ซึ่งจะ return ออกมาเป็น output operation แทนของเดิมที่ return ออกมาเป็น tensor ดังนั้น มันจะไม่แสดงอะไรออกมาจนกว่าจะเอา object นี้ ไปใส่ใน session.run() หรือนำไปใช้เป็น a control dependency โดยใช้ tf.control_dependencies() เช่น           print_op = tf . print ( tensorA )         with tf . control_dependencies ([ print_op ]):   ...