From 58ebc3ae000b0c0e77b5acb3af73a5a08b4c3b74 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Wed, 8 Jan 2020 14:53:53 -0800 Subject: [PATCH] Fix doc inconsistencies in tfjs-node image --- tfjs-node/src/image.ts | 9 +++++---- tfjs-node/src/image_test.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tfjs-node/src/image.ts b/tfjs-node/src/image.ts index fa8f5c87149..e408f346392 100644 --- a/tfjs-node/src/image.ts +++ b/tfjs-node/src/image.ts @@ -31,7 +31,7 @@ export enum ImageType { * * @param contents The JPEG-encoded image in an Uint8Array. * @param channels An optional int. Defaults to 0. Accepted values are - * 0: use the number of channels in the PNG-encoded image. + * 0: use the number of channels in the JPEG-encoded image. * 1: output a grayscale image. * 3: output an RGB image. * @param ratio An optional int. Defaults to 1. Downscaling ratio. It is used @@ -73,7 +73,7 @@ export function decodeJpeg( /** * Decode a PNG-encoded image to a 3D Tensor of dtype `int32`. * - * @param contents The BMP-encoded image in an Uint8Array. + * @param contents The PNG-encoded image in an Uint8Array. * @param channels An optional int. Defaults to 0. Accepted values are * 0: use the number of channels in the PNG-encoded image. * 1: output a grayscale image. @@ -153,7 +153,7 @@ export function decodeGif(contents: Uint8Array): Tensor4D { * @returns A Tensor with dtype `int32` and a 3- or 4-dimensional shape, * depending on the file type. For gif file the returned Tensor shape is * [num_frames, height, width, 3], and for jpeg/png/bmp the returned Tensor - * shape is []height, width, channels] + * shape is [height, width, channels] */ /** * @doc {heading: 'Operations', subheading: 'Images', namespace: 'node'} @@ -301,6 +301,7 @@ export function getImageType(content: Uint8Array): string { return ImageType.BMP; } else { throw new Error( - 'Expected image (JPEG, PNG, or GIF), but got unsupported image type'); + 'Expected image (BMP, JPEG, PNG, or GIF), but got unsupported ' + + 'image type'); } } diff --git a/tfjs-node/src/image_test.ts b/tfjs-node/src/image_test.ts index c97e402a4b8..665e220e65a 100644 --- a/tfjs-node/src/image_test.ts +++ b/tfjs-node/src/image_test.ts @@ -213,7 +213,7 @@ describe('decode images', () => { } catch (error) { expect(error.message) .toBe( - 'Expected image (JPEG, PNG, or GIF), ' + + 'Expected image (BMP, JPEG, PNG, or GIF), ' + 'but got unsupported image type'); done(); }