UNPKG

1.9 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2020 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 { TensorLike } from '../types';
19/**
20 * Computes the logical and of elements across dimensions of a `tf.Tensor`.
21 *
22 * Reduces the input along the dimensions given in `axes`. Unless `keepDims`
23 * is true, the rank of the `tf.Tensor` is reduced by 1 for each entry in
24 * `axes`. If `keepDims` is true, the reduced dimensions are retained with
25 * length 1. If `axes` has no entries, all dimensions are reduced, and an
26 * `tf.Tensor` with a single element is returned.
27 *
28 * ```js
29 * const x = tf.tensor1d([1, 1, 1], 'bool');
30 *
31 * x.all().print(); // or tf.all(x)
32 * ```
33 *
34 * ```js
35 * const x = tf.tensor2d([1, 1, 0, 0], [2, 2], 'bool');
36 *
37 * const axis = 1;
38 * x.all(axis).print(); // or tf.all(x, axis)
39 * ```
40 *
41 * @param x The input tensor. Must be of dtype bool.
42 * @param axis The dimension(s) to reduce. By default it reduces
43 * all dimensions.
44 * @param keepDims If true, retains reduced dimensions with size 1.
45 *
46 * @doc {heading: 'Operations', subheading: 'Reduction'}
47 */
48declare function all_<T extends Tensor>(x: Tensor | TensorLike, axis?: number | number[], keepDims?: boolean): T;
49export declare const all: typeof all_;
50export {};