From c37d38ae2f43777b33b6ac3f9857bb76fac4d9a6 Mon Sep 17 00:00:00 2001 From: Matteo Date: Wed, 7 Jun 2023 15:08:04 +0200 Subject: [PATCH] Fixed test error for deep_learning4e.py --- deep_learning4e.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deep_learning4e.py b/deep_learning4e.py index 9f5b0a8f7..b4e1375b6 100644 --- a/deep_learning4e.py +++ b/deep_learning4e.py @@ -6,7 +6,7 @@ import numpy as np from keras import Sequential, optimizers from keras.layers import Embedding, SimpleRNN, Dense -from keras.preprocessing import sequence +from keras.utils import pad_sequences from utils4e import (conv1D, gaussian_kernel, element_wise_product, vector_add, random_weights, scalar_vector_product, map_vector, mean_squared_error_loss) @@ -518,8 +518,8 @@ def keras_dataset_loader(dataset, max_length=500): # init dataset (X_train, y_train), (X_val, y_val) = dataset if max_length > 0: - X_train = sequence.pad_sequences(X_train, maxlen=max_length) - X_val = sequence.pad_sequences(X_val, maxlen=max_length) + X_train = pad_sequences(X_train, maxlen=max_length) + X_val = pad_sequences(X_val, maxlen=max_length) return (X_train[10:], y_train[10:]), (X_val, y_val), (X_train[:10], y_train[:10])