UNPKG

1.67 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google LLC. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 * =============================================================================
16 */
17import { Tensor } from './tensor';
18import { TensorContainer } from './tensor_types';
19export declare function makeTypesMatch<T extends Tensor>(a: T, b: T): [T, T];
20export declare function assertTypesMatch(a: Tensor, b: Tensor): void;
21export declare function isTensorInList(tensor: Tensor, tensorList: Tensor[]): boolean;
22/**
23 * Extracts any `Tensor`s found within the provided object.
24 *
25 * @param container an object that may be a `Tensor` or may directly contain
26 * `Tensor`s, such as a `Tensor[]` or `{key: Tensor, ...}`. In general it
27 * is safe to pass any object here, except that `Promise`s are not
28 * supported.
29 * @returns An array of `Tensors` found within the passed object. If the
30 * argument is simply a `Tensor', a list containing that `Tensor` is
31 * returned. If the object is not a `Tensor` or does not
32 * contain `Tensors`, an empty list is returned.
33 */
34export declare function getTensorsInContainer(result: TensorContainer): Tensor[];