Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address typos in tfjs-core documentation strings #8184

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion tfjs-core/src/backends/einsum_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export function checkEinsumDimSizes(
*
* @param summedDims indices to the dimensions being summed over.
* @param idDims A look up table for the dimensions present in each input
* tensor. Each consituent array contains indices for the dimensions in the
* tensor. Each constituent array contains indices for the dimensions in the
* corresponding input tensor.
*
* @return A map with two fields:
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/backends/non_max_suppression_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function intersectionOverUnion(boxes: TypedArray, i: number, j: number) {

// A Gaussian penalty function, this method always returns values in [0, 1].
// The weight is a function of similarity, the more overlap two boxes are, the
// smaller the weight is, meaning highly overlapping boxe will be significantly
// smaller the weight is, meaning highly overlapping boxes will be significantly
// penalized. On the other hand, a non-overlapping box will not be penalized.
function suppressWeight(iouThreshold: number, scale: number, iou: number) {
const weight = Math.exp(scale * iou * iou);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export class Engine implements TensorTracker, DataMover {
/**
* Initializes a backend by looking up the backend name in the factory
* registry and calling the factory method. Returns a boolean representing
* whether the initialization of the backend suceeded. Throws an error if
* whether the initialization of the backend succeeded. Throws an error if
* there is no backend in the factory registry.
*/
private initializeBackend(backendName: string):
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/engine_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ describe('Backend registration', () => {
throw new Error('failed to create async2');
}, 101 /* priority */);

// Await for the library to find the best backend that succesfully
// Await for the library to find the best backend that successfully
// initializes.
await tf.ready();
expect(tf.backend()).toEqual(testBackend);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/browser_files_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ describeWithFlags('browserDownloads', BROWSER_ENVS, () => {
// Verify that the default file names are used.
expect(jsonAnchor.download).toEqual('model.json');
expect(jsonAnchor.clicked).toEqual(1);
// The weight file should not have been downoaded.
// The weight file should not have been downloaded.
expect(weightDataAnchor.download).toEqual(undefined);
expect(weightDataAnchor.clicked).toEqual(0);

Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/composite_array_buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class CompositeArrayBuffer {
start = end;
}

// Set the byteLenghth
// Set the byteLength
if (this.shards.length === 0) {
this.byteLength = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ IORouterRegistry.registerLoadRouter(httpRouter);
* The following GitHub Gist
* https://gist.github.com/dsmilkov/1b6046fd6132d7408d5257b0976f7864
* implements a server based on [flask](https://github.com/pallets/flask) that
* can receive the request. Upon receiving the model artifacts via the requst,
* can receive the request. Upon receiving the model artifacts via the request,
* this particular server reconstitutes instances of [Keras
* Models](https://keras.io/models/model/) in memory.
*
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/http_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ describeWithFlags('parseUrl', BROWSER_ENVS, () => {
expect(prefix).toEqual('http://google.com/');
expect(suffix).toEqual('?param=1');
});
it('should parse url with multiple serach params', () => {
it('should parse url with multiple search params', () => {
const url = 'http://google.com/a?x=1/file?param=1';
const [prefix, suffix] = parseUrl(url);
expect(prefix).toEqual('http://google.com/a?x=1/');
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/indexed_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ IORouterRegistry.registerLoadRouter(indexedDBRouter);
*
* @param modelPath A unique identifier for the model to be saved. Must be a
* non-empty string.
* @returns An instance of `BrowserIndexedDB` (sublcass of `IOHandler`),
* @returns An instance of `BrowserIndexedDB` (subclass of `IOHandler`),
* which can be used with, e.g., `tf.Model.save`.
*/
export function browserIndexedDB(modelPath: string): IOHandler {
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/indexed_db_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ describeWithFlags('IndexedDB', BROWSER_ENVS, () => {

try {
await handler.load();
fail('Loading nonexistent model from IndexedDB succeeded unexpectly');
fail('Loading nonexistent model from IndexedDB succeeded unexpectedly');
gaikwadrahul8 marked this conversation as resolved.
Show resolved Hide resolved
} catch (err) {
expect(err.message)
.toEqual(
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/io/weights_loader_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ describeWithFlags('loadWeights', BROWSER_ENVS, () => {
expect(weight2.dtype).toEqual('float32');
});

it('2 group, 4 weights, dont specify weights fetchs all', async () => {
it('2 group, 4 weights, dont specify weights fetches all', async () => {
setupFakeWeightFiles({
'./weightfile0': new Float32Array([1, 2, 3, 4, 5]),
'./weightfile1': new Float32Array([6, 7, 8, 9])
Expand Down
4 changes: 2 additions & 2 deletions tfjs-core/src/jasmine_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export interface TestFilter {
* Tests that have the substrings specified by the include or startsWith
* will be included in the test run, unless one of the substrings specified
* by `excludes` appears in the name.
* @param customInclude Function to programatically include a test.
* @param customInclude Function to programmatically include a test.
* If this function returns true, a test will immediately run. Otherwise,
* `testFilters` is used for fine-grained filtering.
*
Expand All @@ -124,7 +124,7 @@ export function setupTestFilters(
* Filter method that returns boolean, if a given test should run or be
* ignored based on its name. The exclude list has priority over the
* include list. Thus, if a test matches both the exclude and the include
* list, it will be exluded.
* list, it will be excluded.
*/
// tslint:disable-next-line: no-any
const specFilter = (spec: any) => {
Expand Down
4 changes: 2 additions & 2 deletions tfjs-core/src/ops/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export async function fromPixelsAsync(
// In some cases, the input will have larger size than its content.
// E.g. new Image(10, 10) but with 1 x 1 content. Using
// createImageBitmap will clip the size from 10 x 10 to 1 x 1, which
// is not correct. We should avoid wrapping such resouce to
// is not correct. We should avoid wrapping such resource to
// imageBitmap.
if (imageBitmap != null && imageBitmap.width === pixels.width &&
imageBitmap.height === pixels.height) {
Expand Down Expand Up @@ -292,7 +292,7 @@ function validateImgTensor(img: Tensor2D|Tensor3D) {
function validateImageOptions(imageOptions: ImageOptions) {
const alpha = imageOptions ?.alpha || 1;
if (alpha > 1 || alpha < 0) {
throw new Error(`Alpha value ${alpha} is suppoed to be in range [0 - 1].`);
throw new Error(`Alpha value ${alpha} is supposed to be in range [0 - 1].`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/ensure_shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {arraysEqualWithNull} from '../util_base';
import {op} from './operation';

/**
* Checks the input tensor mathes the given shape.
* Checks the input tensor matches the given shape.
*
* Given an input tensor, returns a new tensor with the same values as the
* input tensor with shape `shape`.
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/image/crop_and_resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {op} from '../operation';
* coordinates of the box in the `boxInd[i]`th image in the batch
* @param boxInd 1d int32 tensor of shape `[numBoxes]` with values in range
* `[0, batch)` that specifies the image that the `i`-th box refers to.
* @param cropSize 1d int32 tensor of 2 elements `[cropHeigh, cropWidth]`
* @param cropSize 1d int32 tensor of 2 elements `[cropHeight, cropWidth]`
* specifying the size to which all crops are resized to.
* @param method Optional string from `'bilinear' | 'nearest'`,
* defaults to bilinear, which specifies the sampling method for resizing
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/linalg/qr_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describeWithFlags('qr', ALL_ENVS, () => {
expect(tf.memory().numTensors).toEqual(numTensors + 2);
});

it('Insuffient input tensor rank leads to error', () => {
it('Insufficient input tensor rank leads to error', () => {
const x1 = scalar(12);
expect(() => tf.linalg.qr(x1)).toThrowError(/rank >= 2.*got rank 0/);
const x2 = tensor1d([12]);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/ragged_tensor_to_tensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ import {op} from './operation';
* "ROW_SPLITS": the row_splits tensor from the ragged tensor.
* "VALUE_ROWIDS": the value_rowids tensor from the ragged tensor.
* "FIRST_DIM_SIZE": if value_rowids is used for the first dimension, then
* it is preceeded by "FIRST_DIM_SIZE". The tensors are in the order of
* it is preceded by "FIRST_DIM_SIZE". The tensors are in the order of
* the dimensions.
* @return A Tensor. Has the same type as values.
* @doc {heading: 'Operations', subheading: 'Ragged'}
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/rand_util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export function jarqueBeraNormalityTest(values: TypedArray|number[]) {
const s = skewness(values);
const k = kurtosis(values);
const jb = n / 6 * (Math.pow(s, 2) + 0.25 * Math.pow(k - 3, 2));
// JB test requires 2-degress of freedom from Chi-Square @ 0.95:
// JB test requires 2-degrees of freedom from Chi-Square @ 0.95:
// http://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm
const CHI_SQUARE_2DEG = 5.991;
if (jb > CHI_SQUARE_2DEG) {
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/ops/tensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ import {makeTensor} from './tensor_ops_util';
* const aBuffer = createGPUBufferFromData(device, aData, dtype);
* const shape = [aData.length];
* // To use zeroCopy, use {buffer: aBuffer, zeroCopy: true} instead and destroy
* // aBuffer untill all access is done.
* // aBuffer until all access is done.
* const a = tf.tensor({buffer: aBuffer}, shape, dtype);
* const b = tf.tensor(bData, shape, dtype);
* const result = tf.add(a, b);
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class SerializationMap {
*
* @param cls The class to be registered. It must have a public static member
* called `className` defined and the value must be a non-empty string.
* @param pkg The pakcage name that this class belongs to. This used to define
* @param pkg The package name that this class belongs to. This used to define
* the key in GlobalCustomObject. If not defined, it defaults to `Custom`.
* @param name The name that user specified. It defaults to the actual name of
* the class as specified by its static `className` property.
Expand Down
2 changes: 1 addition & 1 deletion tfjs-core/src/tensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ Object.defineProperty(Tensor, Symbol.hasInstance, {

export function getGlobalTensorClass() {
// Use getGlobal so that we can augment the Tensor class across package
// boundaries becase the node resolution alg may result in different modules
// boundaries because the node resolution alg may result in different modules
// being returned for this file depending on the path they are loaded from.
return getGlobal('Tensor', () => {
return Tensor;
Expand Down