9566 2022. 4. 26. 19:41
728x90

# 4/22
IPyton : Interactive python 
복수의 프로그래밍 언어에서 상호작용적인 컴퓨팅을 하기 위한 명령 셸이며 파이썬 프로그래밍 언어용으로 처음 개발되었다. 
자가 검사, 대화형 매체, 셸 문법, 탭 완성, 히스토리를 제공한다. IPython은 다음 기능을 제공한다:

# tf.constant() : 변하지 않는 상수 생성 # tf.Variable() : 값이 바뀔 수도 있는 변수 생성

tf.Session()
-> tf.Session().run(tf.global_variables_initializer()) 
-> tf.Session().run(tf.constant/tf.Variable) -> tf.Session().run(y, feed_dict={x:tf.placeholder})
-> tf.Session().run(tf.reduce_mean(x, 0))
 

tf.cast() : 소수점을 버리고 정수형으로 만듦
tf.squeeze() : 1을 제거
tf.layers.conv1d
tf.cond(조건, True일때, False일때)
tf.contrib.layers.batch_norm()

   with tf.variance_scope('a'):
            tf.variance_scope('b'):
               tf.get_variance('weight') # 'a/b/weight'

tf.constant_initializer(value)
+ tf.random_uniform_initializer(a, b) # [a, b]를 균일하게 초기화 합니다,
+ tf.random_normal_initializer(mean, stddev) # 주어진 평균 및 표준 편차로 정규 분포에서 초기화합니다.

config = tf.ConfigProto() 
# 1. GPU 설정
 config.gpu_options.visible_device_list = device # GPU가 2개면, 첫 번째 GPU -> "0", 두번째 GPU -> "1" 로 설정 
# 2. GPU 사용량 조절
 config.gpu_options.per_process_gpu_memory_fraction = memory_fraction # memory_fraction=1 : 100% 사용 
# config.gpu_options.allow_growth = False # True : 필요할 때마다 GPU 사용률 조절, False : GPU의 모든 메모리를 점유 
# 3. GPU 대비/검사
 config.allow_soft_placement = True # 선택한 장치가 없으면 다른 장치로 대체 
# config.log_device_placement = True # 어떤 장치로 계산되는지 검사가능

728x90