Skip to content

Commit 5625d70

Browse files
bdwyer2fchollet
authored andcommitted
Various spelling and grammar fixes (keras-team#7793)
* Various spelling and grammar fixes * changed Nvidia to NVIDIA as per review * spelling fix
1 parent 5ce6972 commit 5625d70

28 files changed

+52
-51
lines changed

docker/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ quick links here:
1616

1717
We are using `Makefile` to simplify docker commands within make commands.
1818

19-
Build the container and start a jupyter notebook
19+
Build the container and start a Jupyter Notebook
2020

2121
$ make notebook
2222

@@ -28,7 +28,7 @@ Build the container and start a bash
2828

2929
$ make bash
3030

31-
For GPU support install NVidia drivers (ideally latest) and
31+
For GPU support install NVIDIA drivers (ideally latest) and
3232
[nvidia-docker](https://github.com/NVIDIA/nvidia-docker). Run using
3333

3434
$ make notebook GPU=0 # or [ipython, bash]

docs/templates/regularizers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def l1_reg(weight_matrix):
3939
return 0.01 * K.sum(K.abs(weight_matrix))
4040

4141
model.add(Dense(64, input_dim=64,
42-
kernel_regularizer=l1_reg)
42+
kernel_regularizer=l1_reg))
4343
```
4444

4545
Alternatively, you can write your regularizers in an object-oriented way;

examples/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Trains a convolutional stack followed by a recurrent stack network on the IMDB s
4040
Trains a FastText model on the IMDB sentiment classification task.
4141

4242
[imdb_lstm.py](imdb_lstm.py)
43-
Trains a LSTM on the IMDB sentiment classification task.
43+
Trains an LSTM model on the IMDB sentiment classification task.
4444

4545
[lstm_benchmark.py](lstm_benchmark.py)
4646
Compares different LSTM implementations on the IMDB sentiment classification task.

examples/conv_lstm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def generate_movies(n_samples=1200, n_frames=15):
125125
if i >= 7:
126126
ax.text(1, 3, 'Predictions !', fontsize=20, color='w')
127127
else:
128-
ax.text(1, 3, 'Inital trajectory', fontsize=20)
128+
ax.text(1, 3, 'Initial trajectory', fontsize=20)
129129

130130
toplot = track[i, ::, ::, 0]
131131

examples/image_ocr.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def paint_text(text, w, h, rotate=False, ud=False, multi_fonts=False):
8080
with cairo.Context(surface) as context:
8181
context.set_source_rgb(1, 1, 1) # White
8282
context.paint()
83-
# this font list works in Centos 7
83+
# this font list works in CentOS 7
8484
if multi_fonts:
8585
fonts = ['Century Schoolbook', 'Courier', 'STIX', 'URW Chancery L', 'FreeMono']
8686
context.select_font_face(np.random.choice(fonts), cairo.FONT_SLANT_NORMAL,

examples/imdb_lstm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'''Trains a LSTM on the IMDB sentiment classification task.
1+
'''Trains an LSTM model on the IMDB sentiment classification task.
22
The dataset is actually too small for LSTM to be of any advantage
33
compared to simpler, much faster methods such as TF-IDF + LogReg.
44
Notes:

examples/mnist_hierarchical_rnn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""This is an example of using Hierarchical RNN (HRNN) to classify MNIST digits.
22
3-
HRNNs can learn across multiple levels of temporal hiearchy over a complex sequence.
3+
HRNNs can learn across multiple levels of temporal hierarchy over a complex sequence.
44
Usually, the first recurrent layer of an HRNN encodes a sentence (e.g. of word vectors)
55
into a sentence vector. The second recurrent layer then encodes a sequence of
66
such vectors (encoded by the first layer) into a document vector. This

examples/mnist_swwae.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def getwhere(x):
105105
'Theano backend for the time being, '
106106
'because it requires taking the gradient '
107107
'of a gradient, which isn\'t '
108-
'supported for all TF ops.')
108+
'supported for all TensorFlow ops.')
109109

110110
# This example assume 'channels_first' data format.
111111
K.set_image_data_format('channels_first')

examples/pretrained_word_embeddings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''This script loads pre-trained word embeddings (GloVe embeddings)
22
into a frozen Keras Embedding layer, and uses it to
33
train a text classification model on the 20 Newsgroup dataset
4-
(classication of newsgroup messages into 20 different categories).
4+
(classification of newsgroup messages into 20 different categories).
55
66
GloVe embedding data can be found at:
77
http://nlp.stanford.edu/data/glove.6B.zip

keras/applications/resnet50.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def identity_block(input_tensor, kernel_size, filters, stage, block):
4343
# Arguments
4444
input_tensor: input tensor
4545
kernel_size: default 3, the kernel size of middle conv layer at main path
46-
filters: list of integers, the filterss of 3 conv layer at main path
46+
filters: list of integers, the filters of 3 conv layer at main path
4747
stage: integer, current stage label, used for generating layer names
4848
block: 'a','b'..., current block label, used for generating layer names
4949
@@ -81,7 +81,7 @@ def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2))
8181
# Arguments
8282
input_tensor: input tensor
8383
kernel_size: default 3, the kernel size of middle conv layer at main path
84-
filters: list of integers, the filterss of 3 conv layer at main path
84+
filters: list of integers, the filters of 3 conv layer at main path
8585
stage: integer, current stage label, used for generating layer names
8686
block: 'a','b'..., current block label, used for generating layer names
8787

keras/backend/cntk_backend.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def in_train_phase(x, alt, training=None):
8888

8989
def in_test_phase(x, alt):
9090
global _LEARNING_PHASE
91-
# Similiar as in_train_phase, use element_select as workaround.
91+
# Similar as in_train_phase, use element_select as workaround.
9292
if callable(x) and isinstance(x, C.cntk_py.Function) is False:
9393
x = x()
9494
if callable(alt) and isinstance(alt, C.cntk_py.Function) is False:
@@ -700,7 +700,7 @@ def _normalize_axis(axis, x):
700700

701701
if nones > ndim:
702702
raise ValueError('CNTK Backend: tensor with keras shape: `%s` has '
703-
'%d cntk dynamic axis, this is not expected, plesae '
703+
'%d cntk dynamic axis, this is not expected, please '
704704
'double check the keras shape history.' % (str(shape), nones))
705705

706706
# Current cntk does not support shape like (1, batch). so using the workaround
@@ -1079,7 +1079,7 @@ def reshape(x, shape):
10791079
return x
10801080
return C.user_function(ReshapeBatch(x, shape[1:]))
10811081
else:
1082-
# no collaps, then first need to padding the shape
1082+
# no collapse, then first need to padding the shape
10831083
if num_dynamic_axis >= len(shape):
10841084
i = 0
10851085
while i < len(shape):
@@ -1194,7 +1194,7 @@ def _static_rnn(step_function, inputs, initial_states,
11941194
raise ValueError('CNTK Backend: the input of static rnn '
11951195
'has shape `%s`, the second axis '
11961196
'is not static. If you want to run '
1197-
'rnn with non-static axis, plesae try '
1197+
'rnn with non-static axis, please try '
11981198
'dynamic rnn with sequence axis.' % shape)
11991199
if constants is None:
12001200
constants = []

keras/backend/tensorflow_backend.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
# This dictionary holds a mapping {graph: UID_DICT}.
3737
# each UID_DICT is a dictionary mapping name prefixes to a current index,
38-
# used for generatic graph-specific string UIDs
38+
# used for generic graph-specific string UIDs
3939
# for various names (e.g. layer names).
4040
_GRAPH_UID_DICTS = {}
4141

@@ -3591,10 +3591,10 @@ def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
35913591

35923592

35933593
# CTC
3594-
# tensorflow has a native implemenation, but it uses sparse tensors
3594+
# TensorFlow has a native implementation, but it uses sparse tensors
35953595
# and therefore requires a wrapper for Keras. The functions below convert
35963596
# dense to sparse tensors and also wraps up the beam search code that is
3597-
# in tensorflow's CTC implementation
3597+
# in TensorFlow's CTC implementation
35983598

35993599

36003600
def ctc_label_dense_to_sparse(labels, label_lengths):

keras/backend/theano_backend.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,8 @@ def reverse(x, axes):
11591159
return x[slices]
11601160

11611161

1162-
def pattern_broadcast(x, broatcastable):
1163-
return T.patternbroadcast(x, broatcastable)
1162+
def pattern_broadcast(x, broadcastable):
1163+
return T.patternbroadcast(x, broadcastable)
11641164

11651165
# VALUE MANIPULATION
11661166

@@ -2249,7 +2249,7 @@ def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
22492249
# Theano implementation of CTC
22502250
# Used with permission from Shawn Tan
22512251
# https://github.com/shawntan/
2252-
# Note that tensorflow's native CTC code is significantly
2252+
# Note that TensorFlow's native CTC code is significantly
22532253
# faster than this
22542254

22552255

keras/callbacks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class ProgbarLogger(Callback):
248248
# Arguments
249249
count_mode: One of "steps" or "samples".
250250
Whether the progress bar should
251-
count samples seens or steps (batches) seen.
251+
count samples seen or steps (batches) seen.
252252
253253
# Raises
254254
ValueError: In case of invalid `count_mode`.

keras/engine/topology.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ def __call__(self, inputs, **kwargs):
616616
else:
617617
output = output_ls_copy
618618

619-
# Infering the output shape is only relevant for Theano.
619+
# Inferring the output shape is only relevant for Theano.
620620
if all([s is not None for s in _to_list(input_shape)]):
621621
output_shape = self.compute_output_shape(input_shape)
622622
else:

keras/layers/convolutional_recurrent.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def input_conv(self, x, w, b=None, padding='valid'):
503503
data_format=self.data_format)
504504
return conv_out
505505

506-
def reccurent_conv(self, x, w):
506+
def recurrent_conv(self, x, w):
507507
conv_out = K.conv2d(x, w, strides=(1, 1),
508508
padding='same',
509509
data_format=self.data_format)
@@ -524,13 +524,13 @@ def step(self, inputs, states):
524524
padding=self.padding)
525525
x_o = self.input_conv(inputs * dp_mask[3], self.kernel_o, self.bias_o,
526526
padding=self.padding)
527-
h_i = self.reccurent_conv(h_tm1 * rec_dp_mask[0],
527+
h_i = self.recurrent_conv(h_tm1 * rec_dp_mask[0],
528528
self.recurrent_kernel_i)
529-
h_f = self.reccurent_conv(h_tm1 * rec_dp_mask[1],
529+
h_f = self.recurrent_conv(h_tm1 * rec_dp_mask[1],
530530
self.recurrent_kernel_f)
531-
h_c = self.reccurent_conv(h_tm1 * rec_dp_mask[2],
531+
h_c = self.recurrent_conv(h_tm1 * rec_dp_mask[2],
532532
self.recurrent_kernel_c)
533-
h_o = self.reccurent_conv(h_tm1 * rec_dp_mask[3],
533+
h_o = self.recurrent_conv(h_tm1 * rec_dp_mask[3],
534534
self.recurrent_kernel_o)
535535

536536
i = self.recurrent_activation(x_i + h_i)

keras/layers/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Masking(Layer):
3636
# Example
3737
3838
Consider a Numpy data array `x` of shape `(samples, timesteps, features)`,
39-
to be fed to a LSTM layer.
39+
to be fed to an LSTM layer.
4040
You want to mask timestep #3 and #5 because you lack data for
4141
these timesteps. You can:
4242

keras/losses.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .utils.generic_utils import deserialize_keras_object
55

66

7+
# noinspection SpellCheckingInspection
78
def mean_squared_error(y_true, y_pred):
89
return K.mean(K.square(y_pred - y_true), axis=-1)
910

keras/preprocessing/image.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ class DirectoryIterator(Iterator):
908908
to use for random transformations and normalization.
909909
target_size: tuple of integers, dimensions to resize input images to.
910910
color_mode: One of `"rgb"`, `"grayscale"`. Color mode to read images.
911-
classes: Optional list of strings, names of sudirectories
911+
classes: Optional list of strings, names of subdirectories
912912
containing images from each class (e.g. `["dogs", "cats"]`).
913913
It will be computed automatically if not set.
914914
class_mode: Mode for yielding the targets:

keras/preprocessing/sequence.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def skipgrams(sequence, vocabulary_size,
139139
integers (eg. [0, 1, 1 .. ]),
140140
if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]
141141
sampling_table: 1D array of size `vocabulary_size` where the entry i
142-
encodes the probabibily to sample a word of rank i.
142+
encodes the probability to sample a word of rank i.
143143
seed: random seed.
144144
145145
# Returns

tests/integration_tests/test_temporal_data_tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def test_masked_temporal():
206206
assert(np.abs(history.history['loss'][-1] - ground_truth) < 0.06)
207207

208208

209-
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TF backend')
209+
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TensorFlow backend')
210210
@keras_test
211211
def test_embedding_with_clipnorm():
212212
model = Sequential()

tests/keras/applications/applications_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,31 +164,31 @@ def test_vgg19_pooling_specified_input_shape():
164164

165165
@keras_test
166166
@pytest.mark.skipif((K.backend() != 'tensorflow'),
167-
reason='Requires tensorflow backend')
167+
reason='Requires TensorFlow backend')
168168
def test_xception():
169169
model = applications.Xception(weights=None)
170170
assert model.output_shape == (None, 1000)
171171

172172

173173
@keras_test
174174
@pytest.mark.skipif((K.backend() != 'tensorflow'),
175-
reason='Requires tensorflow backend')
175+
reason='Requires TensorFlow backend')
176176
def test_xception_notop():
177177
model = applications.Xception(weights=None, include_top=False)
178178
assert model.output_shape == (None, None, None, 2048)
179179

180180

181181
@keras_test
182182
@pytest.mark.skipif((K.backend() != 'tensorflow'),
183-
reason='Requires tensorflow backend')
183+
reason='Requires TensorFlow backend')
184184
def test_xception_pooling():
185185
model = applications.Xception(weights=None, include_top=False, pooling='avg')
186186
assert model.output_shape == (None, 2048)
187187

188188

189189
@keras_test
190190
@pytest.mark.skipif((K.backend() != 'tensorflow'),
191-
reason='Requires tensorflow backend')
191+
reason='Requires TensorFlow backend')
192192
def test_xception_variable_input_channels():
193193
input_shape = (1, None, None) if K.image_data_format() == 'channels_first' else (None, None, 1)
194194
model = applications.Xception(weights=None, include_top=False, input_shape=input_shape)

tests/keras/backend/backend_test.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
BACKENDS.append(KTF)
2323
except ImportError:
2424
KTF = None
25-
warnings.warn('Could not import the Tensorflow backend.')
25+
warnings.warn('Could not import the TensorFlow backend.')
2626

2727
try:
2828
from keras.backend import theano_backend as KTH
@@ -694,7 +694,7 @@ def test_nn_operations(self):
694694
# cross_entropy call require the label is a valid probability distribution,
695695
# otherwise it is garbage in garbage out...
696696
# due to the algo difference, we can't guarantee CNTK has the same result on the garbage input.
697-
# so create a seperate test case for valid lable input
697+
# so create a separate test case for valid label input
698698
check_two_tensor_operation('categorical_crossentropy', (4, 2), (4, 2), [KTH, KTF], from_logits=True)
699699
xval = np.asarray([[0.26157712, 0.0432167], [-0.43380741, 0.30559841],
700700
[0.20225059, -0.38956559], [-0.13805378, 0.08506755]], dtype=np.float32)
@@ -1028,7 +1028,7 @@ def test_bias_add(self):
10281028
BACKENDS, cntk_dynamicity=True,
10291029
data_format=data_format)
10301030

1031-
# Test invalid use casess
1031+
# Test invalid use cases
10321032
for k in BACKENDS:
10331033
x = k.variable(np.random.random(x_shape))
10341034
b = k.variable(np.random.random(bias_shape))

tests/keras/engine/test_topology.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def test_shared_layer_depth_is_correct():
689689

690690

691691
@keras_test
692-
def test_layer_sharing_at_heterogenous_depth():
692+
def test_layer_sharing_at_heterogeneous_depth():
693693
x_val = np.random.random((10, 5))
694694

695695
x = Input(shape=(5,))
@@ -711,7 +711,7 @@ def test_layer_sharing_at_heterogenous_depth():
711711

712712

713713
@keras_test
714-
def test_layer_sharing_at_heterogenous_depth_with_concat():
714+
def test_layer_sharing_at_heterogeneous_depth_with_concat():
715715
input_shape = (16, 9, 3)
716716
input_layer = Input(shape=input_shape)
717717

tests/keras/engine/test_training.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def gen_data(batch_sz):
417417
assert all(['Sequence' not in str(w_.message) for w_ in w]), 'A warning was raised for Sequence.'
418418

419419

420-
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='sparse operations supported only by TF')
420+
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='sparse operations supported only by TensorFlow')
421421
@keras_test
422422
def test_sparse_input_validation_split():
423423
test_input = sparse.random(6, 3, density=0.25).tocsr()
@@ -478,7 +478,7 @@ def test_check_bad_shape():
478478
assert 'targets to have the same shape' in str(exc)
479479

480480

481-
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TF backend')
481+
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TensorFlow backend')
482482
@keras_test
483483
def test_model_with_input_feed_tensor():
484484
"""We test building a model with a TF variable as input.

tests/keras/legacy/layers_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_sequential_regression():
275275

276276
branch_1_2 = models.Sequential([legacy_layers.Merge([branch_1, branch_2], mode='concat')], name='branch_1_2')
277277
branch_1_2.add(layers.Dense(16, name='dense_1_2-0'))
278-
# test whether impromtu input_shape breaks the model
278+
# test whether impromptu input_shape breaks the model
279279
branch_1_2.add(layers.Dense(16, input_shape=(16,), name='dense_1_2-1'))
280280

281281
model = models.Sequential([legacy_layers.Merge([branch_1_2, branch_3], mode='concat')], name='final')

tests/keras/optimizers_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_clipvalue():
117117

118118
@keras_test
119119
@pytest.mark.skipif((K.backend() != 'tensorflow'),
120-
reason='Requires tensorflow backend')
120+
reason='Requires TensorFlow backend')
121121
def test_tfoptimizer():
122122
from keras import constraints
123123
from tensorflow import train

0 commit comments

Comments
 (0)