Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix imports following Keras code reorganization #1240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deep_learning4e.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import statistics

import numpy as np
from keras import Sequential, optimizers
from keras.layers import Embedding, SimpleRNN, Dense
from keras.preprocessing import sequence
from tensorflow.keras import Sequential, optimizers
from tensorflow.keras.layers import Embedding, SimpleRNN, Dense
from tensorflow.keras.preprocessing import sequence

from utils4e import (conv1D, gaussian_kernel, element_wise_product, vector_add, random_weights,
scalar_vector_product, map_vector, mean_squared_error_loss)
Expand Down
5 changes: 3 additions & 2 deletions perception4e.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from keras.datasets import mnist
from keras.layers import Dense, Activation, Flatten, InputLayer, Conv2D, MaxPooling2D
from keras.models import Sequential
from tensorflow.keras.utils import to_categorical

from utils4e import gaussian_kernel_2D

Expand Down Expand Up @@ -309,8 +310,8 @@ def load_MINST(train_size, val_size, test_size):
x_train /= 255
test_x = x_test.astype('float32')
test_x /= 255
y_train = keras.utils.to_categorical(y_train, 10)
y_test = keras.utils.to_categorical(y_test, 10)
y_train = to_categorical(y_train, 10)
y_test = to_categorical(y_test, 10)
return ((x_train[:train_size], y_train[:train_size]),
(x_train[train_size:train_size + val_size], y_train[train_size:train_size + val_size]),
(x_test[:test_size], y_test[:test_size]))
Expand Down