에러발생
(py37) parkgyeongtae-2:2_cartpole-v1 pgt0409$ python 7_test.py
2022-04-29 13:20:30.672022: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
문제의 코드
from keras.models import Sequential
from keras.layers import Dense
from tensorflow.keras.optimizers import Adam
def build_model():
model = Sequential()
model.add(Dense(128, input_dim = 4, activation = 'relu'))
model.add(Dense(64, activation = 'relu'))
model.add(Dense(32, activation = 'relu'))
model.add(Dense(16, activation = 'relu'))
model.add(Dense(2, activation = 'softmax'))
model.compile(loss='mse', optimizer = Adam())
return model
model = build_model()
print(model.summary())
에러 해결된 코드
from keras.models import Sequential
from keras.layers import Dense
from tensorflow.keras.optimizers import Adam
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def build_model():
model = Sequential()
model.add(Dense(128, input_dim = 4, activation = 'relu'))
model.add(Dense(64, activation = 'relu'))
model.add(Dense(32, activation = 'relu'))
model.add(Dense(16, activation = 'relu'))
model.add(Dense(2, activation = 'softmax'))
model.compile(loss='mse', optimizer = Adam())
return model
model = build_model()
print(model.summary())
'Programming Language > Python' 카테고리의 다른 글
[Python] RL, 강화학습 Frozen Lake v1 자동실행 하는 방법 (0) | 2022.05.02 |
---|---|
[Python] Keras로 생성한 모델 요약 출력하는 방법 (0) | 2022.04.29 |
[Python] ImportError: cannot import name 'Adam' from 'keras.optimizers' (0) | 2022.04.28 |
[Python] random.randrange(2) 확인해보기 (0) | 2022.04.28 |
[Python] random.random() 확인하기 (0) | 2022.04.28 |