Skip to content

Commit

Permalink
Fix documentation issues
Browse files Browse the repository at this point in the history
DOC 

* Update docs for fromPixels
* Improve docs for tidy
  • Loading branch information
tafsiri authored Jun 5, 2018
1 parent 607979f commit 32cface
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/ops/array_ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ export class ArrayOps {
}
const inferredShape = util.inferShape(values);
if (inferredShape.length !== 5 && inferredShape.length !== 1) {
throw new Error(
'tensor5d() requires values to be \
throw new Error('tensor5d() requires values to be \
number[][][][][] or flat/TypedArray');
}
if (inferredShape.length === 1 && shape == null) {
Expand Down Expand Up @@ -674,10 +673,11 @@ export class ArrayOps {
* tf.fromPixels(image).print();
* ```
*
* @param pixels The input image to construct the tensor from.
* @param numChannels The number of channels of the output tensor. The
* supported image types are all 4-channel by default, a numChannels value
* less than 4 allows you to ignore channels.
* @param pixels The input image to construct the tensor from. The
* supported image types are all 4-channel.
* @param numChannels The number of channels of the output tensor. A
* numChannels value less than 4 allows you to ignore channels. Defaults to
* 3 (ignores alpha channel of input image).
*/
@doc({heading: 'Tensors', subheading: 'Creation'})
@operation
Expand Down
8 changes: 5 additions & 3 deletions src/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {extractTensorsFromAny} from './util';

export class Tracking {
/**
* Executes the provided function `f` and after it is executed, cleans up all
* intermediate tensors allocated by `f` except those returned by `f`.
* Executes the provided function `fn` and after it is executed, cleans up all
* intermediate tensors allocated by `fn` except those returned by `fn`.
* `f` must not return a Promise (async functions not allowed).
* The returned result can be a complex object, however tidy only walks the
* top-level properties (depth 1) of that object to search for tensors, or
Expand Down Expand Up @@ -61,11 +61,13 @@ export class Tracking {
* If debug mode is on, the timing and the memory usage of the function
* will be tracked and displayed on the console using the provided name.
* @param fn The function to execute.
* @param gradMode If true, starts a tape and doesn't dispose tensors.
*/
@doc({heading: 'Performance', subheading: 'Memory'})
static tidy<T extends TensorContainer>(
nameOrFn: string|ScopeFn<T>, fn?: ScopeFn<T>, gradMode = false): T {
// gradMode Primarily for internal use during backprop
// If true, will start a tape if it is the outermost tidy.

let name = null;
if (fn == null) {
// Called with only 1 argument.
Expand Down

0 comments on commit 32cface

Please sign in to comment.