UNPKG

2 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google LLC
4 *
5 * Use of this source code is governed by an MIT-style
6 * license that can be found in the LICENSE file or at
7 * https://opensource.org/licenses/MIT.
8 * =============================================================================
9 */
10/// <amd-module name="@tensorflow/tfjs-layers/dist/types" />
11/** Defines allowable data types for tensors. */
12import { NamedTensorMap, Scalar, Tensor } from '@tensorflow/tfjs-core';
13import { Shape } from './keras_format/common';
14export interface NamedTensor {
15 name: string;
16 tensor: Tensor;
17}
18export declare type HasShape = {
19 shape: Shape;
20};
21/**
22 * Type for loss a metric function.
23 *
24 * Takes a true value and a predicted value, and returns a loss or metric value.
25 */
26export declare type LossOrMetricFn = (yTrue: Tensor, yPred: Tensor) => Tensor;
27/**
28 * Type for a regularizer function.
29 */
30export declare type RegularizerFn = () => Scalar;
31export declare type RnnStepFunction = (inputs: Tensor, states: Tensor[]) => [Tensor, Tensor[]];
32/**
33 * A single Tensor or a non-nested collection of Tensors.
34 *
35 * An object of this type can always be reduced to `Tensor[]`. A single
36 * 'Tensor' becomes `[Tensor]`. A `Tensor[]` is unchanged. A `NamedTensorMap`
37 * can be converted with the help of a list of names, providing the order in
38 * which the Tensors should appear in the resulting array.
39 */
40export declare type TensorOrArrayOrMap = Tensor | Tensor[] | NamedTensorMap;
41/**
42 * Type representing a loosely-typed bundle of keyword arguments.
43 *
44 * This is a looser type than PyJsonDict/serialization.ConfigDict as it
45 * can contain arbitrary objects as its values. It is most appropriate
46 * for functions that pass through keyword arguments to other functions
47 * without knowledge of the structure. If the function can place type
48 * restrictions on the keyword arguments, it should via the Config
49 * interface convention used throughout.
50 */
51export declare type Kwargs = {
52 [key: string]: any;
53};