Skip to content

Commit

Permalink
Fix typos in the documentation strings of the tfjs-layers directory (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gaikwadrahul8 authored Oct 10, 2024
1 parent 636c616 commit 15c00f8
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tfjs-layers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ys = tf.tensor2d([[1], [3], [5], [7]], [4, 1]);
// Train the model.
await model.fit(xs, ys, {epochs: 500});

// Ater the training, perform inference.
// After the training, perform inference.
const output = model.predict(tf.tensor2d([[5]], [1, 1]));
output.print();
```
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/demos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Once the development environment is prepared, execute the build script from the
```

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
local HTTP server. Navigate to the local URL spcecified in stdout to bring up
local HTTP server. Navigate to the local URL specified in stdout to bring up
the benchmarks page UI. There will be a button to begin the JS side of the
benchmarks. Clicking the button will run through and time the same models, now
running in the browser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe('TransformerDecoder', () => {
const config = testLayer.getConfig();
const restored = TransformerDecoder.fromConfig(TransformerDecoder, config);

// Initializers don't get serailized with customObjects.
// Initializers don't get serialized with customObjects.
delete ((config['kernelInitializer'] as serialization.ConfigDict
)['config'] as serialization.ConfigDict)['customObjects'];
delete ((config['biasInitializer'] as serialization.ConfigDict
Expand Down Expand Up @@ -167,5 +167,5 @@ describe('TransformerDecoder', () => {
expectTensorsClose(outputCache, noLoopCache);
});

// TODO(pforderique): Test mask propogation once supported.
// TODO(pforderique): Test mask propagation once supported.
});
2 changes: 1 addition & 1 deletion tfjs-layers/src/layers/nlp/models/gpt2/gpt2_causal_lm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export declare interface GPT2CausalLMArgs extends PipelineModelArgs {
}

/**
* An end-to-end GPT2 model for causal langauge modeling.
* An end-to-end GPT2 model for causal language modeling.
*
* A causal language model (LM) predicts the next token based on previous
* tokens. This task setup can be used to train the model unsupervised on
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/layers/nlp/multihead_attention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ export class MultiHeadAttention extends Layer {

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

// TODO(pforderique): Support mask propogation.
// TODO(pforderique): Support mask propagation.
return super.apply(newInputs, kwargs);
}

Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/layers/normalization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ export interface LayerNormalizationLayerArgs extends LayerArgs {
axis?: number|number[];

/**
* A small positive float added to variance to avoid divison by zero.
* A small positive float added to variance to avoid division by zero.
* Defaults to 1e-3.
*/
epsilon?: number;
Expand Down
4 changes: 2 additions & 2 deletions tfjs-layers/src/layers/normalization_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ describeMathCPUAndWebGL2('BatchNormalization Layers: Tensor', () => {
const x = tensor2d([[1, 2], [3, 4]], [2, 2]);
expectTensorsClose(layer.apply(x) as Tensor, x, 0.01);
expect(layer.getWeights().length).toEqual(3);
// Firt weight is gamma.
// First weight is gamma.
expectTensorsClose(layer.getWeights()[0], onesLike(layer.getWeights()[0]));
// Second weight is moving mean.
expectTensorsClose(layer.getWeights()[1], zerosLike(layer.getWeights()[1]));
Expand All @@ -366,7 +366,7 @@ describeMathCPUAndWebGL2('BatchNormalization Layers: Tensor', () => {
const x = tensor2d([[1, 2], [3, 4]], [2, 2]);
expectTensorsClose(layer.apply(x) as Tensor, x, 0.01);
expect(layer.getWeights().length).toEqual(3);
// Firt weight is beta.
// First weight is beta.
expectTensorsClose(layer.getWeights()[0], zerosLike(layer.getWeights()[0]));
// Second weight is moving mean.
expectTensorsClose(layer.getWeights()[1], zerosLike(layer.getWeights()[1]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describeMathCPUAndGPU('Resizing Layer', () => {
});

it('Returns a tensor of the correct dtype', () => {
// do a same resizing operation, cheeck tensors dtypes and content
// do a same resizing operation, check tensors dtypes and content
const height = 40;
const width = 60;
const numChannels = 3;
Expand Down
4 changes: 2 additions & 2 deletions tfjs-layers/src/layers/preprocessing/random_height.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type InterpolationType = typeof INTERPOLATION_KEYS[number];
*
* The input should be a 3D (unbatched) or
* 4D (batched) tensor in the `"channels_last"` image data format. Input pixel
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of interger
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of integer
* or floating point dtype. By default, the layer will output floats.
*
* tf methods implemented in tfjs: 'bilinear', 'nearest',
Expand All @@ -48,7 +48,7 @@ export class RandomHeight extends BaseRandomLayer {
/** @nocollapse */
static override className = 'RandomHeight';
private readonly factor: number | [number, number];
private readonly interpolation?: InterpolationType; // defualt = 'bilinear
private readonly interpolation?: InterpolationType; // default = 'bilinear
private heightLower: number;
private heightUpper: number;
private imgWidth: number;
Expand Down
4 changes: 2 additions & 2 deletions tfjs-layers/src/layers/preprocessing/random_width.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type InterpolationType = typeof INTERPOLATION_KEYS[number];
*
* The input should be a 3D (unbatched) or
* 4D (batched) tensor in the `"channels_last"` image data format. Input pixel
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of interger
* values can be of any range (e.g. `[0., 1.)` or `[0, 255]`) and of integer
* or floating point dtype. By default, the layer will output floats.
*
* tf methods implemented in tfjs: 'bilinear', 'nearest',
Expand All @@ -48,7 +48,7 @@ export class RandomWidth extends BaseRandomLayer {
/** @nocollapse */
static override className = 'RandomWidth';
private readonly factor: number | [number, number];
private readonly interpolation?: InterpolationType; // defualt = 'bilinear
private readonly interpolation?: InterpolationType; // default = 'bilinear
private widthLower: number;
private widthUpper: number;
private imgHeight: number;
Expand Down
8 changes: 4 additions & 4 deletions tfjs-layers/src/layers/recurrent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export declare interface BaseRNNLayerArgs extends LayerArgs {
* see section "Note on passing external constants" below.
* Porting Node: PyKeras overrides the `call()` signature of RNN cells,
* which are Layer subtypes, to accept two arguments. tfjs-layers does
* not do such overriding. Instead we preseve the `call()` signature,
* not do such overriding. Instead we preserve the `call()` signature,
* which due to its `Tensor|Tensor[]` argument and return value is
* flexible enough to handle the inputs and states.
* - a `stateSize` attribute. This can be a single integer (single state)
Expand Down Expand Up @@ -757,7 +757,7 @@ export class RNN extends Layer {

const output = this.returnSequences ? outputs : lastOutput;

// TODO(cais): Porperty set learning phase flag.
// TODO(cais): Property set learning phase flag.

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

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

// TODO(cais): Maybe implemnt `losses` and `getLossesFor`.
// TODO(cais): Maybe implement `losses` and `getLossesFor`.
}
serialization.registerClass(StackedRNNCells);

Expand Down

0 comments on commit 15c00f8

Please sign in to comment.