Remove reference to deprecated `random_integers` numpy method.
@@ -180,20 +180,22 @@ def test_masked_temporal():
The ground-truth best cross-entropy loss should, then be -log(0.5) = 0.69
'''
+ np.random.seed(1338)
+
model = Sequential()
model.add(layers.Embedding(10, 10, mask_zero=True))
model.add(layers.Activation('softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='adam')
- x = np.random.random_integers(1, 9, (20000, 10))
+ x = np.random.randint(1, 10, size=(20000, 10))
for rowi in range(x.shape[0]):
- padding = np.random.random_integers(x.shape[1] / 2)
+ padding = np.random.randint(0, x.shape[1] / 2 + 1)
x[rowi, :padding] = 0
# 50% of the time the correct output is the input.
# The other 50% of the time it's 2 * input % 10
- y = (x * np.random.random_integers(1, 2, x.shape)) % 10
+ y = (x * np.random.randint(1, 3, size=x.shape)) % 10
ys = np.zeros((y.size, 10), dtype='int32')
for i, target in enumerate(y.flat):
ys[i, target] = 1
