Skip to content

Commit 15c00f8

Browse files
Fix typos in the documentation strings of the tfjs-layers directory (#8411)
1 parent 636c616 commit 15c00f8

11 files changed

+18
-18
lines changed

tfjs-layers/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const ys = tf.tensor2d([[1], [3], [5], [7]], [4, 1]);
5252
// Train the model.
5353
await model.fit(xs, ys, {epochs: 500});
5454

55-
// Ater the training, perform inference.
55+
// After the training, perform inference.
5656
const output = model.predict(tf.tensor2d([[5]], [1, 1]));
5757
output.print();
5858
```

tfjs-layers/demos/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Once the development environment is prepared, execute the build script from the
1616
```
1717

1818
The script will construct a number of Keras models in Python and benchmark their training using the TensorFlow backend. When it is complete, it will bring up a
19-
local HTTP server. Navigate to the local URL spcecified in stdout to bring up
19+
local HTTP server. Navigate to the local URL specified in stdout to bring up
2020
the benchmarks page UI. There will be a button to begin the JS side of the
2121
benchmarks. Clicking the button will run through and time the same models, now
2222
running in the browser.

tfjs-layers/src/layers/nlp/modeling/transformer_decoder_test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('TransformerDecoder', () => {
106106
const config = testLayer.getConfig();
107107
const restored = TransformerDecoder.fromConfig(TransformerDecoder, config);
108108

109-
// Initializers don't get serailized with customObjects.
109+
// Initializers don't get serialized with customObjects.
110110
delete ((config['kernelInitializer'] as serialization.ConfigDict
111111
)['config'] as serialization.ConfigDict)['customObjects'];
112112
delete ((config['biasInitializer'] as serialization.ConfigDict
@@ -167,5 +167,5 @@ describe('TransformerDecoder', () => {
167167
expectTensorsClose(outputCache, noLoopCache);
168168
});
169169

170-
// TODO(pforderique): Test mask propogation once supported.
170+
// TODO(pforderique): Test mask propagation once supported.
171171
});

tfjs-layers/src/layers/nlp/models/gpt2/gpt2_causal_lm.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export declare interface GPT2CausalLMArgs extends PipelineModelArgs {
7070
}
7171

7272
/**
73-
* An end-to-end GPT2 model for causal langauge modeling.
73+
* An end-to-end GPT2 model for causal language modeling.
7474
*
7575
* A causal language model (LM) predicts the next token based on previous
7676
* tokens. This task setup can be used to train the model unsupervised on

tfjs-layers/src/layers/nlp/multihead_attention.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ export class MultiHeadAttention extends Layer {
703703

704704
newInputs = [inputs, kwargs['value']].concat(kwargs['key'] ?? []);
705705

706-
// TODO(pforderique): Support mask propogation.
706+
// TODO(pforderique): Support mask propagation.
707707
return super.apply(newInputs, kwargs);
708708
}
709709

tfjs-layers/src/layers/normalization.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export interface LayerNormalizationLayerArgs extends LayerArgs {
430430
axis?: number|number[];
431431

432432
/**
433-
* A small positive float added to variance to avoid divison by zero.
433+
* A small positive float added to variance to avoid division by zero.
434434
* Defaults to 1e-3.
435435
*/
436436
epsilon?: number;

tfjs-layers/src/layers/normalization_test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ describeMathCPUAndWebGL2('BatchNormalization Layers: Tensor', () => {
353353
const x = tensor2d([[1, 2], [3, 4]], [2, 2]);
354354
expectTensorsClose(layer.apply(x) as Tensor, x, 0.01);
355355
expect(layer.getWeights().length).toEqual(3);
356-
// Firt weight is gamma.
356+
// First weight is gamma.
357357
expectTensorsClose(layer.getWeights()[0], onesLike(layer.getWeights()[0]));
358358
// Second weight is moving mean.
359359
expectTensorsClose(layer.getWeights()[1], zerosLike(layer.getWeights()[1]));
@@ -366,7 +366,7 @@ describeMathCPUAndWebGL2('BatchNormalization Layers: Tensor', () => {
366366
const x = tensor2d([[1, 2], [3, 4]], [2, 2]);
367367
expectTensorsClose(layer.apply(x) as Tensor, x, 0.01);
368368
expect(layer.getWeights().length).toEqual(3);
369-
// Firt weight is beta.
369+
// First weight is beta.
370370
expectTensorsClose(layer.getWeights()[0], zerosLike(layer.getWeights()[0]));
371371
// Second weight is moving mean.
372372
expectTensorsClose(layer.getWeights()[1], zerosLike(layer.getWeights()[1]));

tfjs-layers/src/layers/preprocessing/image_resizing_test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describeMathCPUAndGPU('Resizing Layer', () => {
8888
});
8989

9090
it('Returns a tensor of the correct dtype', () => {
91-
// do a same resizing operation, cheeck tensors dtypes and content
91+
// do a same resizing operation, check tensors dtypes and content
9292
const height = 40;
9393
const width = 60;
9494
const numChannels = 3;

tfjs-layers/src/layers/preprocessing/random_height.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type InterpolationType = typeof INTERPOLATION_KEYS[number];
3535
*
3636
* The input should be a 3D (unbatched) or
3737
* 4D (batched) tensor in the `"channels_last"` image data format. Input pixel
38-
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of interger
38+
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of integer
3939
* or floating point dtype. By default, the layer will output floats.
4040
*
4141
* tf methods implemented in tfjs: 'bilinear', 'nearest',
@@ -48,7 +48,7 @@ export class RandomHeight extends BaseRandomLayer {
4848
/** @nocollapse */
4949
static override className = 'RandomHeight';
5050
private readonly factor: number | [number, number];
51-
private readonly interpolation?: InterpolationType; // defualt = 'bilinear
51+
private readonly interpolation?: InterpolationType; // default = 'bilinear
5252
private heightLower: number;
5353
private heightUpper: number;
5454
private imgWidth: number;

tfjs-layers/src/layers/preprocessing/random_width.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type InterpolationType = typeof INTERPOLATION_KEYS[number];
3535
*
3636
* The input should be a 3D (unbatched) or
3737
* 4D (batched) tensor in the `"channels_last"` image data format. Input pixel
38-
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of interger
38+
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of integer
3939
* or floating point dtype. By default, the layer will output floats.
4040
*
4141
* tf methods implemented in tfjs: 'bilinear', 'nearest',
@@ -48,7 +48,7 @@ export class RandomWidth extends BaseRandomLayer {
4848
/** @nocollapse */
4949
static override className = 'RandomWidth';
5050
private readonly factor: number | [number, number];
51-
private readonly interpolation?: InterpolationType; // defualt = 'bilinear
51+
private readonly interpolation?: InterpolationType; // default = 'bilinear
5252
private widthLower: number;
5353
private widthUpper: number;
5454
private imgHeight: number;

tfjs-layers/src/layers/recurrent.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export declare interface BaseRNNLayerArgs extends LayerArgs {
252252
* see section "Note on passing external constants" below.
253253
* Porting Node: PyKeras overrides the `call()` signature of RNN cells,
254254
* which are Layer subtypes, to accept two arguments. tfjs-layers does
255-
* not do such overriding. Instead we preseve the `call()` signature,
255+
* not do such overriding. Instead we preserve the `call()` signature,
256256
* which due to its `Tensor|Tensor[]` argument and return value is
257257
* flexible enough to handle the inputs and states.
258258
* - a `stateSize` attribute. This can be a single integer (single state)
@@ -757,7 +757,7 @@ export class RNN extends Layer {
757757

758758
const output = this.returnSequences ? outputs : lastOutput;
759759

760-
// TODO(cais): Porperty set learning phase flag.
760+
// TODO(cais): Property set learning phase flag.
761761

762762
if (this.returnState) {
763763
return [output].concat(states);
@@ -1933,7 +1933,7 @@ export class StackedRNNCells extends RNNCell {
19331933

19341934
get stateSize(): number[] {
19351935
// States are a flat list in reverse order of the cell stack.
1936-
// This allows perserving the requirement `stack.statesize[0] ===
1936+
// This allows preserving the requirement `stack.statesize[0] ===
19371937
// outputDim`. E.g., states of a 2-layer LSTM would be `[h2, c2, h1, c1]`,
19381938
// assuming one LSTM has states `[h, c]`.
19391939
const stateSize: number[] = [];
@@ -2098,7 +2098,7 @@ export class StackedRNNCells extends RNNCell {
20982098
batchSetValue(tuples);
20992099
}
21002100

2101-
// TODO(cais): Maybe implemnt `losses` and `getLossesFor`.
2101+
// TODO(cais): Maybe implement `losses` and `getLossesFor`.
21022102
}
21032103
serialization.registerClass(StackedRNNCells);
21042104

0 commit comments

Comments
 (0)