@tensorflow/tfjs-layers
Version:
TensorFlow layers API in JavaScript
37 lines (36 loc) • 1.61 kB
TypeScript
/**
* @license
* Copyright 2019 Google LLC
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
/// <amd-module name="@tensorflow/tfjs-layers/dist/user_defined_metadata" />
/** Utility functions related to user-defined metadata. */
export declare const MAX_USER_DEFINED_METADATA_SERIALIZED_LENGTH: number;
/**
* Check validity of user-defined metadata.
*
* @param userDefinedMetadata
* @param modelName Name of the model that the user-defined metadata belongs to.
* Used during construction of error messages.
* @param checkSize Whether to check the size of the metadata is under
* recommended limit. Default: `false`. If `true`, will try stringify the
* JSON object and print a console warning if the serialzied size is above the
* limit.
* @throws Error if `userDefinedMetadata` is not a plain JSON object.
*/
export declare function checkUserDefinedMetadata(userDefinedMetadata: {}, modelName: string, checkSize?: boolean): void;
/**
* Check if an input is plain JSON object or any valid subfield of it.
*
* @param x The input to be checked.
* @param assertObject Whether to assert `x` is a JSON object, i.e., reject
* cases of arrays and primitives.
* @return Returns `true` if and only if `x` is a plain JSON object,
* a JSON-valid primitive including string, number, boolean and null,
* or an array of the said types.
*/
export declare function plainObjectCheck(x: any): boolean;