Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tfjs-converter/src/executor/graph_model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {GraphExecutor} from './graph_executor';
export const TFHUB_SEARCH_PARAM = '?tfjs-format=file';
export const DEFAULT_MODEL_NAME = 'model.json';
/**
* A `tf.GraphModel` is a directed, acyclic graph of built from
* SavedModel GraphDef and allows inference exeuction.
* A `tf.GraphModel` is a directed, acyclic graph built from a
* SavedModel GraphDef and allows inference execution.
*
* A `tf.GraphModel` can only be created by loading from a model converted from
* a [TensorFlow SavedModel](https://www.tensorflow.org/guide/saved_model) using
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/backend/tfjs_backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export function repeat(x: Tensor, n: number): Tensor {
}

/**
* Flatten an Tensor into 1D.
* Flatten a Tensor into 1D.
* @param x Input tensor.
* @return The result of the flattening `x`.
*/
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/backend/tfjs_backend_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('TensorMath', () => {
});

describe('dtype', () => {
it('returns float32 for an Tensor', () => {
it('returns float32 for a Tensor', () => {
const x = zeros([1]);
expect(x.dtype).toEqual('float32');
});
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/engine/topology_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ describeMathCPU('Layer', () => {
describe('apply() passed 1+ Tensors', () => {
it('returns new values for output if the same as the input.', () => {
const anArray = ones([1]);
// Test with both an Tensor and an array of Tensors.
// Test with both a Tensor and an array of Tensors.
for (const inputs of [anArray, [anArray, anArray]]) {
const layer = new LayerForTest();
const result = layer.apply(inputs) as Tensor | Tensor[];
Expand Down
4 changes: 2 additions & 2 deletions tfjs-layers/src/engine/training.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ export class LayersModel extends Container implements tfc.InferenceModel {
* model.predict(tf.ones([8, 10]), {batchSize: 4}).print();
* ```
*
* @param x The input data, as an Tensor, or an `Array` of `tf.Tensor`s if
* @param x The input data, as a Tensor, or an `Array` of `tf.Tensor`s if
* the model has multiple inputs.
* @param args A `ModelPredictArgs` object containing optional fields.
*
Expand Down Expand Up @@ -1123,7 +1123,7 @@ export class LayersModel extends Container implements tfc.InferenceModel {
* });
* model.predictOnBatch(tf.ones([8, 10])).print();
* ```
* @param x: Input samples, as an Tensor (for models with exactly one
* @param x: Input samples, as a Tensor (for models with exactly one
* input) or an array of Tensors (for models with more than one input).
* @return Tensor(s) of predictions
*/
Expand Down
10 changes: 5 additions & 5 deletions tfjs-layers/src/engine/training_dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ export interface ModelFitDatasetArgs<T> {
batchesPerEpoch?: number;

/**
* The number of times to iterate over the training dataset.
*
* An integer.
* Integer number of times to iterate over the training dataset.
*/
epochs: number;

Expand Down Expand Up @@ -143,7 +141,9 @@ export interface ModelFitDatasetArgs<T> {

/**
* Epoch at which to start training (useful for resuming a previous training
* run).
* run). When this is used, `epochs` is the index of the "final epoch".
* The model is not trained for a number of iterations given by `epochs`,
* but merely until the epoch of index `epochs` is reached.
*/
initialEpoch?: number;

Expand Down Expand Up @@ -512,7 +512,7 @@ function getStepsPerEpoch<T>(
return stepsPerEpoch;
}

// Check if provided object is a Dataset object by checking it's .iterator
// Check if provided object is a Dataset object by checking its .iterator
// element.
function isDatasetObject<T>(
dataset:
Expand Down
15 changes: 7 additions & 8 deletions tfjs-layers/src/engine/training_tensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ export interface ModelFitArgs {
batchSize?: number;

/**
* The number of times to iterate over the training data arrays.
* Note that when used with `initialEpoch`, epochs is the index of the
* "final epoch". The model is not trained for a number of iterations
* given by epochs, but merely until the epoch of index epochs is reached.
* Integer number of times to iterate over the training data arrays.
*/
epochs?: number;

Expand Down Expand Up @@ -121,7 +118,9 @@ export interface ModelFitArgs {

/**
* Epoch at which to start training (useful for resuming a previous training
* run).
* run). When this is used, `epochs` is the index of the "final epoch".
* The model is not trained for a number of iterations given by `epochs`,
* but merely until the epoch of index `epochs` is reached.
*/
initialEpoch?: number;

Expand Down Expand Up @@ -168,7 +167,7 @@ export function checkBatchSize(batchSize: number) {
}

/**
* Slice an Tensor or an Array of Tensors, by start and stop indices.
* Slice a Tensor or an Array of Tensors, by start and stop indices.
*
* Porting Note: The `_slice_arrays` function in PyKeras is covered by this
* function and `sliceArraysByIndices()` together.
Expand All @@ -192,7 +191,7 @@ export function sliceArrays(
}

/**
* Slice an Tensor or an Array of Tensors, by random-order indices.
* Slice a Tensor or an Array of Tensors, by random-order indices.
*
* Porting Note: The `_slice_arrays` function in PyKeras is covered by this
* function and `sliceArrays()` together.
Expand Down Expand Up @@ -476,7 +475,7 @@ export async function fitTensors(
args.validationSplit != null && args.validationSplit > 0 &&
args.validationSplit < 1) {
doValidation = true;
// Porting Note: In tfjs-layers, inputs[0] is always an Tensor.
// Porting Note: In tfjs-layers, inputs[0] is always a Tensor.
const splitAt =
Math.floor(inputs[0].shape[0] * (1 - args.validationSplit));
const originalBatchSize = inputs[0].shape[0];
Expand Down
6 changes: 3 additions & 3 deletions tfjs-layers/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ export function sequential(config?: SequentialArgs): Sequential {
* 1. Models created with the `tf.layers.*`, `tf.sequential`, and
* `tf.model` APIs of TensorFlow.js and later saved with the
* `tf.LayersModel.save` method.
* 2. Models converted from Keras or TensorFlow tf.keras using
* the [tensorflowjs_converter](https://github.com/tensorflow/tfjs-converter)
* 2. Models converted from Keras or TensorFlow tf.keras using the
* [tensorflowjs_converter](https://github.com/tensorflow/tfjs/tree/master/tfjs-converter).
*
* This mode is *not* applicable to TensorFlow `SavedModel`s or their converted
* forms. For those models, use `tf.loadGraphModel`.
Expand Down Expand Up @@ -222,7 +222,7 @@ export function sequential(config?: SequentialArgs): Sequential {
* - `strict`: Require that the provided weights exactly match those required
* by the layers. Default true. Passing false means that both extra
* weights and missing weights will be silently ignored.
* - onProgress: A function of the signature `(fraction: number) => void',
* - `onProgress`: A function of the signature `(fraction: number) => void',
* that can be used as the progress callback for the model loading.
* @returns A `Promise` of `tf.LayersModel`, with the topology and weights
* loaded.
Expand Down
4 changes: 2 additions & 2 deletions tfjs-layers/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export class Sequential extends LayersModel {
* model.predict(tf.ones([2, 10])).print();
* ```
*
* @param x The input data, as an Tensor, or an `Array` of `tf.Tensor`s if
* @param x The input data, as a Tensor, or an `Array` of `tf.Tensor`s if
* the model has multiple inputs.
* @param conifg A `ModelPredictConfig` object containing optional fields.
*
Expand All @@ -780,7 +780,7 @@ export class Sequential extends LayersModel {
/**
* Returns predictions for a single batch of samples.
*
* @param x: Input samples, as an Tensor, or list of Tensors (if the model
* @param x: Input samples, as a Tensor, or list of Tensors (if the model
* has multiple inputs).
* @return Tensor(s) of predictions
*/
Expand Down
2 changes: 1 addition & 1 deletion tfjs-layers/src/utils/test_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ registerTestEnv({
});

/**
* Expect values are close between an Tensor or number array.
* Expect values are close between a Tensor or number array.
* @param actual
* @param expected
*/
Expand Down