Programming
| No. | 822 |
| Name. | swindler |
| Subject. | tensorflow |
| Main Cate. | 개발일반 |
| Sub Cate. | |
| Date. | 2021-05-21 15:53 |
| Hit. | 1356 (121.134.199.74) |
| File. | |
| 아래 코드는 tensowflow 2.x 에서 1.x 예제로 공부하다보니 1.x 버전으로 사용하게끔 하였음 CUDA를 지원하지 않아, 매번 에러메세지가 뜨기 때문에 LOG_LEVEL을 조정했음 import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # 로그레벨 조정 2 -> INFO, WARNING 출력 안함 #import tensorflow as tf # tensorflow 1.x 버전으로 사용 import tensorflow.compat.v1 as tf tf.disable_v2_behavior() X = tf.placeholder(tf.float32, [None, 3]) print(X) input = [[1,2,3],[4,5,6]] W = tf.Variable(tf.random_normal([3,2])) b = tf.Variable(tf.random_normal([2,1])) hypothesis = tf.matmul(X,W) + b sess = tf.Session() sess.run(tf.global_variables_initializer()) print("-------- INPUT --------") print(input) print("-------- W --------") print(sess.run(W)) print("-------- b --------") print(sess.run(b)) print("-------- hypothesis --------") print(sess.run(hypothesis, feed_dict={X: input})) sess.close() [바로가기 링크] : http://coolx.net/cboard/develop/822 |
|
|
|
|
| [Modify] [Delete] | [Reply] [List] | |

Copyright © 1999-2017, swindler. All rights reserved.
367,611 visitor ( 1999.1.8-2004.5.26 ), 2,405,771 ( -2017.01.31)