tensorflow 예제
-
Tensorflow Multilayer Perceptron 예시 코드(MLP, MNIST DataSet)Data Science/Tensorflow 2022. 10. 24. 23:13
1. 기본 세팅 1.1 라이브러리 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import random import os 1.2 랜덤시드 고정 매번 동일한 결과를 가져오기 위한 랜덤시드 고정 random.seed(1) np.random.seed(1) tf.random.set_seed(1) 1.3 GPU 세팅 os.environ["CUDA_VISIBLE_DEVICES"]="0" gpus = tf.config.experimental.list_physical_devices('GPU') if gpus: try: tf.config.experimental.set_memory_growth(gpus[0], True) except ..