Skip to content

Commit a4877b8

Browse files
committed
take mean of a_grads
1 parent b8c586e commit a4877b8

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

kerasTUT/5-classifier_example.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
# data pre-processing
2626
X_train = X_train.reshape(X_train.shape[0], -1) / 255. # normalize
2727
X_test = X_test.reshape(X_test.shape[0], -1) / 255. # normalize
28-
y_train = np_utils.to_categorical(y_train, nb_classes=10)
29-
y_test = np_utils.to_categorical(y_test, nb_classes=10)
28+
y_train = np_utils.to_categorical(y_train, num_classes=10)
29+
y_test = np_utils.to_categorical(y_test, num_classes=10)
3030

3131
# Another way to build your neural net
3232
model = Sequential([
@@ -46,7 +46,7 @@
4646

4747
print('Training ------------')
4848
# Another way to train the model
49-
model.fit(X_train, y_train, nb_epoch=2, batch_size=32)
49+
model.fit(X_train, y_train, epoch=2, batch_size=32)
5050

5151
print('\nTesting ------------')
5252
# Evaluate the model with the metrics we defined earlier

kerasTUT/6-CNN_example.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
# data pre-processing
3030
X_train = X_train.reshape(-1, 1,28, 28)/255.
3131
X_test = X_test.reshape(-1, 1,28, 28)/255.
32-
y_train = np_utils.to_categorical(y_train, nb_classes=10)
33-
y_test = np_utils.to_categorical(y_test, nb_classes=10)
32+
y_train = np_utils.to_categorical(y_train, num_classes=10)
33+
y_test = np_utils.to_categorical(y_test, num_classes=10)
3434

3535
# Another way to build your CNN
3636
model = Sequential()
@@ -80,7 +80,7 @@
8080

8181
print('Training ------------')
8282
# Another way to train the model
83-
model.fit(X_train, y_train, nb_epoch=1, batch_size=32,)
83+
model.fit(X_train, y_train, epoch=1, batch_size=32,)
8484

8585
print('\nTesting ------------')
8686
# Evaluate the model with the metrics we defined earlier

kerasTUT/7-RNN_Classifier_example.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
# data pre-processing
4040
X_train = X_train.reshape(-1, 28, 28) / 255. # normalize
4141
X_test = X_test.reshape(-1, 28, 28) / 255. # normalize
42-
y_train = np_utils.to_categorical(y_train, nb_classes=10)
43-
y_test = np_utils.to_categorical(y_test, nb_classes=10)
42+
y_train = np_utils.to_categorical(y_train, num_classes=10)
43+
y_test = np_utils.to_categorical(y_test, num_classes=10)
4444

4545
# build RNN model
4646
model = Sequential()

0 commit comments

Comments
 (0)