-
Notifications
You must be signed in to change notification settings - Fork 221
Expand file tree
/
Copy path8.3 Tensorboard debugging.py
More file actions
48 lines (24 loc) · 940 Bytes
/
8.3 Tensorboard debugging.py
File metadata and controls
48 lines (24 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# coding: utf-8
# In[1]:
from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# In[2]:
from keras.models import Sequential
from keras.layers import Dense
x_train.shape = (60000, 28 * 28)
x_test.shape = (10000, 28 * 28)
x_train = x_train / 255
x_test = x_test / 255
model = Sequential()
model.add(Dense(512,activation='relu',input_dim= 28*28))
model.add(Dense(512,activation='relu'))
model.add(Dense(512,activation='relu'))
model.add(Dense(10,activation='softmax'))
model.compile(loss='sparse_categorical_crossentropy',optimizer='adam',metrics=['acc'])
from keras.callbacks import TensorBoard
import tensorflow as tf
from tensorflow.python import debug as tf_debug
import keras
keras.backend.set_session(
tf_debug.TensorBoardDebugWrapperSession(tf.Session(), "localhost:2018"))
hist = model.fit(x_train*255,y_train,batch_size=128,epochs=5,validation_data=(x_test*255,y_test))