머신러닝 - 관련 +1

** 주의 이론적으로 틀린 부분이 있을 수 있습니다.


Tensorflow 01 : constant -----------------------------

인자

. value : 반환 타입 dtype의 상수값 (또는 리스트).

. dtype : 결과값 텐서 원소들의 타입

. shape : 결과값 텐서의 차원 (선택사항)

. name : 텐서의 명칭 (선택사항)


------------------------------------------------------

import tensorflow as tf

dtype(data type)

정수형

tf.int8 - char - 1byte

tf.int16 - short - 2byte

tf.int32

tf.int64 - int - 4byte

실수형

tf.float8

tf.float16

tf.float32

tf.float64

string

tf.string // tf.str

_ref 가 붙는 녀석들이 있는데 아직 잘 모르겠음

------------------------------------------------------

ex 01

import tensorflow as tf

v = tf.constant(value=12, dtype=tf.int8)
sess = tf.Session()
w = sess.run(v)
print ("w => %d"%(w))
sess.close()
--------------------------------------------
ex 02
v = tf.constant(value=0x10,
dtype=tf.int16,
name= "constant_number")

sess = tf.Session()
w = sess.run(v)
print (w)

sess.close()

[+] name 값에 화이트 스페이스 주면 에러남

--------------------------------------------

ex 03
import tensorflow as tf

strValue = tf.constant(value="hello world",
dtype=tf.string,
name="string_type_variable")

sess = tf.Session()
v = sess.run(strValue)
print (v)
sess.close()