Skip to content

Commit

Permalink
Various spelling and grammar fixes (#7793)
Browse files Browse the repository at this point in the history
* Various spelling and grammar fixes

* changed Nvidia to NVIDIA as per review

* spelling fix
  • Loading branch information
bdwyer2 authored and fchollet committed Sep 5, 2017
1 parent 5ce6972 commit 5625d70
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 51 deletions.
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ quick links here:

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

Build the container and start a jupyter notebook
Build the container and start a Jupyter Notebook

$ make notebook

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

$ make bash

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

$ make notebook GPU=0 # or [ipython, bash]
Expand Down
2 changes: 1 addition & 1 deletion docs/templates/regularizers.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def l1_reg(weight_matrix):
return 0.01 * K.sum(K.abs(weight_matrix))

model.add(Dense(64, input_dim=64,
kernel_regularizer=l1_reg)
kernel_regularizer=l1_reg))
```

Alternatively, you can write your regularizers in an object-oriented way;
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Trains a convolutional stack followed by a recurrent stack network on the IMDB s
Trains a FastText model on the IMDB sentiment classification task.

[imdb_lstm.py](imdb_lstm.py)
Trains a LSTM on the IMDB sentiment classification task.
Trains an LSTM model on the IMDB sentiment classification task.

[lstm_benchmark.py](lstm_benchmark.py)
Compares different LSTM implementations on the IMDB sentiment classification task.
Expand Down
2 changes: 1 addition & 1 deletion examples/conv_lstm.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def generate_movies(n_samples=1200, n_frames=15):
if i >= 7:
ax.text(1, 3, 'Predictions !', fontsize=20, color='w')
else:
ax.text(1, 3, 'Inital trajectory', fontsize=20)
ax.text(1, 3, 'Initial trajectory', fontsize=20)

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

Expand Down
2 changes: 1 addition & 1 deletion examples/image_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def paint_text(text, w, h, rotate=False, ud=False, multi_fonts=False):
with cairo.Context(surface) as context:
context.set_source_rgb(1, 1, 1) # White
context.paint()
# this font list works in Centos 7
# this font list works in CentOS 7
if multi_fonts:
fonts = ['Century Schoolbook', 'Courier', 'STIX', 'URW Chancery L', 'FreeMono']
context.select_font_face(np.random.choice(fonts), cairo.FONT_SLANT_NORMAL,
Expand Down
2 changes: 1 addition & 1 deletion examples/imdb_lstm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'''Trains a LSTM on the IMDB sentiment classification task.
'''Trains an LSTM model on the IMDB sentiment classification task.
The dataset is actually too small for LSTM to be of any advantage
compared to simpler, much faster methods such as TF-IDF + LogReg.
Notes:
Expand Down
2 changes: 1 addition & 1 deletion examples/mnist_hierarchical_rnn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""This is an example of using Hierarchical RNN (HRNN) to classify MNIST digits.
HRNNs can learn across multiple levels of temporal hiearchy over a complex sequence.
HRNNs can learn across multiple levels of temporal hierarchy over a complex sequence.
Usually, the first recurrent layer of an HRNN encodes a sentence (e.g. of word vectors)
into a sentence vector. The second recurrent layer then encodes a sequence of
such vectors (encoded by the first layer) into a document vector. This
Expand Down
2 changes: 1 addition & 1 deletion examples/mnist_swwae.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def getwhere(x):
'Theano backend for the time being, '
'because it requires taking the gradient '
'of a gradient, which isn\'t '
'supported for all TF ops.')
'supported for all TensorFlow ops.')

# This example assume 'channels_first' data format.
K.set_image_data_format('channels_first')
Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_word_embeddings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''This script loads pre-trained word embeddings (GloVe embeddings)
into a frozen Keras Embedding layer, and uses it to
train a text classification model on the 20 Newsgroup dataset
(classication of newsgroup messages into 20 different categories).
(classification of newsgroup messages into 20 different categories).
GloVe embedding data can be found at:
http://nlp.stanford.edu/data/glove.6B.zip
Expand Down
4 changes: 2 additions & 2 deletions keras/applications/resnet50.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def identity_block(input_tensor, kernel_size, filters, stage, block):
# Arguments
input_tensor: input tensor
kernel_size: default 3, the kernel size of middle conv layer at main path
filters: list of integers, the filterss of 3 conv layer at main path
filters: list of integers, the filters of 3 conv layer at main path
stage: integer, current stage label, used for generating layer names
block: 'a','b'..., current block label, used for generating layer names
Expand Down Expand Up @@ -81,7 +81,7 @@ def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2))
# Arguments
input_tensor: input tensor
kernel_size: default 3, the kernel size of middle conv layer at main path
filters: list of integers, the filterss of 3 conv layer at main path
filters: list of integers, the filters of 3 conv layer at main path
stage: integer, current stage label, used for generating layer names
block: 'a','b'..., current block label, used for generating layer names
Expand Down
8 changes: 4 additions & 4 deletions keras/backend/cntk_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def in_train_phase(x, alt, training=None):

def in_test_phase(x, alt):
global _LEARNING_PHASE
# Similiar as in_train_phase, use element_select as workaround.
# Similar as in_train_phase, use element_select as workaround.
if callable(x) and isinstance(x, C.cntk_py.Function) is False:
x = x()
if callable(alt) and isinstance(alt, C.cntk_py.Function) is False:
Expand Down Expand Up @@ -700,7 +700,7 @@ def _normalize_axis(axis, x):

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

# Current cntk does not support shape like (1, batch). so using the workaround
Expand Down Expand Up @@ -1079,7 +1079,7 @@ def reshape(x, shape):
return x
return C.user_function(ReshapeBatch(x, shape[1:]))
else:
# no collaps, then first need to padding the shape
# no collapse, then first need to padding the shape
if num_dynamic_axis >= len(shape):
i = 0
while i < len(shape):
Expand Down Expand Up @@ -1194,7 +1194,7 @@ def _static_rnn(step_function, inputs, initial_states,
raise ValueError('CNTK Backend: the input of static rnn '
'has shape `%s`, the second axis '
'is not static. If you want to run '
'rnn with non-static axis, plesae try '
'rnn with non-static axis, please try '
'dynamic rnn with sequence axis.' % shape)
if constants is None:
constants = []
Expand Down
6 changes: 3 additions & 3 deletions keras/backend/tensorflow_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

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

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


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


def ctc_label_dense_to_sparse(labels, label_lengths):
Expand Down
6 changes: 3 additions & 3 deletions keras/backend/theano_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,8 +1159,8 @@ def reverse(x, axes):
return x[slices]


def pattern_broadcast(x, broatcastable):
return T.patternbroadcast(x, broatcastable)
def pattern_broadcast(x, broadcastable):
return T.patternbroadcast(x, broadcastable)

# VALUE MANIPULATION

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


Expand Down
2 changes: 1 addition & 1 deletion keras/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class ProgbarLogger(Callback):
# Arguments
count_mode: One of "steps" or "samples".
Whether the progress bar should
count samples seens or steps (batches) seen.
count samples seen or steps (batches) seen.
# Raises
ValueError: In case of invalid `count_mode`.
Expand Down
2 changes: 1 addition & 1 deletion keras/engine/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def __call__(self, inputs, **kwargs):
else:
output = output_ls_copy

# Infering the output shape is only relevant for Theano.
# Inferring the output shape is only relevant for Theano.
if all([s is not None for s in _to_list(input_shape)]):
output_shape = self.compute_output_shape(input_shape)
else:
Expand Down
10 changes: 5 additions & 5 deletions keras/layers/convolutional_recurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def input_conv(self, x, w, b=None, padding='valid'):
data_format=self.data_format)
return conv_out

def reccurent_conv(self, x, w):
def recurrent_conv(self, x, w):
conv_out = K.conv2d(x, w, strides=(1, 1),
padding='same',
data_format=self.data_format)
Expand All @@ -524,13 +524,13 @@ def step(self, inputs, states):
padding=self.padding)
x_o = self.input_conv(inputs * dp_mask[3], self.kernel_o, self.bias_o,
padding=self.padding)
h_i = self.reccurent_conv(h_tm1 * rec_dp_mask[0],
h_i = self.recurrent_conv(h_tm1 * rec_dp_mask[0],
self.recurrent_kernel_i)
h_f = self.reccurent_conv(h_tm1 * rec_dp_mask[1],
h_f = self.recurrent_conv(h_tm1 * rec_dp_mask[1],
self.recurrent_kernel_f)
h_c = self.reccurent_conv(h_tm1 * rec_dp_mask[2],
h_c = self.recurrent_conv(h_tm1 * rec_dp_mask[2],
self.recurrent_kernel_c)
h_o = self.reccurent_conv(h_tm1 * rec_dp_mask[3],
h_o = self.recurrent_conv(h_tm1 * rec_dp_mask[3],
self.recurrent_kernel_o)

i = self.recurrent_activation(x_i + h_i)
Expand Down
2 changes: 1 addition & 1 deletion keras/layers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Masking(Layer):
# Example
Consider a Numpy data array `x` of shape `(samples, timesteps, features)`,
to be fed to a LSTM layer.
to be fed to an LSTM layer.
You want to mask timestep #3 and #5 because you lack data for
these timesteps. You can:
Expand Down
1 change: 1 addition & 0 deletions keras/losses.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .utils.generic_utils import deserialize_keras_object


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

Expand Down
2 changes: 1 addition & 1 deletion keras/preprocessing/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ class DirectoryIterator(Iterator):
to use for random transformations and normalization.
target_size: tuple of integers, dimensions to resize input images to.
color_mode: One of `"rgb"`, `"grayscale"`. Color mode to read images.
classes: Optional list of strings, names of sudirectories
classes: Optional list of strings, names of subdirectories
containing images from each class (e.g. `["dogs", "cats"]`).
It will be computed automatically if not set.
class_mode: Mode for yielding the targets:
Expand Down
2 changes: 1 addition & 1 deletion keras/preprocessing/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def skipgrams(sequence, vocabulary_size,
integers (eg. [0, 1, 1 .. ]),
if True labels will be categorical eg. [[1,0],[0,1],[0,1] .. ]
sampling_table: 1D array of size `vocabulary_size` where the entry i
encodes the probabibily to sample a word of rank i.
encodes the probability to sample a word of rank i.
seed: random seed.
# Returns
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_temporal_data_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_masked_temporal():
assert(np.abs(history.history['loss'][-1] - ground_truth) < 0.06)


@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TF backend')
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TensorFlow backend')
@keras_test
def test_embedding_with_clipnorm():
model = Sequential()
Expand Down
8 changes: 4 additions & 4 deletions tests/keras/applications/applications_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,31 +164,31 @@ def test_vgg19_pooling_specified_input_shape():

@keras_test
@pytest.mark.skipif((K.backend() != 'tensorflow'),
reason='Requires tensorflow backend')
reason='Requires TensorFlow backend')
def test_xception():
model = applications.Xception(weights=None)
assert model.output_shape == (None, 1000)


@keras_test
@pytest.mark.skipif((K.backend() != 'tensorflow'),
reason='Requires tensorflow backend')
reason='Requires TensorFlow backend')
def test_xception_notop():
model = applications.Xception(weights=None, include_top=False)
assert model.output_shape == (None, None, None, 2048)


@keras_test
@pytest.mark.skipif((K.backend() != 'tensorflow'),
reason='Requires tensorflow backend')
reason='Requires TensorFlow backend')
def test_xception_pooling():
model = applications.Xception(weights=None, include_top=False, pooling='avg')
assert model.output_shape == (None, 2048)


@keras_test
@pytest.mark.skipif((K.backend() != 'tensorflow'),
reason='Requires tensorflow backend')
reason='Requires TensorFlow backend')
def test_xception_variable_input_channels():
input_shape = (1, None, None) if K.image_data_format() == 'channels_first' else (None, None, 1)
model = applications.Xception(weights=None, include_top=False, input_shape=input_shape)
Expand Down
6 changes: 3 additions & 3 deletions tests/keras/backend/backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
BACKENDS.append(KTF)
except ImportError:
KTF = None
warnings.warn('Could not import the Tensorflow backend.')
warnings.warn('Could not import the TensorFlow backend.')

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

# Test invalid use casess
# Test invalid use cases
for k in BACKENDS:
x = k.variable(np.random.random(x_shape))
b = k.variable(np.random.random(bias_shape))
Expand Down
4 changes: 2 additions & 2 deletions tests/keras/engine/test_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def test_shared_layer_depth_is_correct():


@keras_test
def test_layer_sharing_at_heterogenous_depth():
def test_layer_sharing_at_heterogeneous_depth():
x_val = np.random.random((10, 5))

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


@keras_test
def test_layer_sharing_at_heterogenous_depth_with_concat():
def test_layer_sharing_at_heterogeneous_depth_with_concat():
input_shape = (16, 9, 3)
input_layer = Input(shape=input_shape)

Expand Down
4 changes: 2 additions & 2 deletions tests/keras/engine/test_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def gen_data(batch_sz):
assert all(['Sequence' not in str(w_.message) for w_ in w]), 'A warning was raised for Sequence.'


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


@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TF backend')
@pytest.mark.skipif(K.backend() != 'tensorflow', reason='Requires TensorFlow backend')
@keras_test
def test_model_with_input_feed_tensor():
"""We test building a model with a TF variable as input.
Expand Down
2 changes: 1 addition & 1 deletion tests/keras/legacy/layers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def test_sequential_regression():

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

model = models.Sequential([legacy_layers.Merge([branch_1_2, branch_3], mode='concat')], name='final')
Expand Down
2 changes: 1 addition & 1 deletion tests/keras/optimizers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def test_clipvalue():

@keras_test
@pytest.mark.skipif((K.backend() != 'tensorflow'),
reason='Requires tensorflow backend')
reason='Requires TensorFlow backend')
def test_tfoptimizer():
from keras import constraints
from tensorflow import train
Expand Down
Loading

0 comments on commit 5625d70

Please sign in to comment.