UNPKG

1.91 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 */
17/// <amd-module name="@tensorflow/tfjs-core/dist/ops/dense_bincount" />
18import { Tensor1D, Tensor2D } from '../tensor';
19import { TensorLike } from '../types';
20/**
21 * Outputs a vector with length `size` and the same dtype as `weights`.
22 *
23 * If `weights` are empty, then index `i` stores the number of times the value
24 * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the
25 * sum of the value in `weights` at each index where the corresponding value in
26 * `x` is `i`.
27 *
28 * Values in `x` outside of the range [0, size) are ignored.
29 *
30 * @param x The input int tensor, rank 1 or rank 2.
31 * @param weights The weights tensor, must have the same shape as x, or a
32 * length-0 Tensor, in which case it acts as all weights equal to 1.
33 * @param size Non-negative integer.
34 * @param binaryOutput Optional. Whether the kernel should count the appearance
35 * or number of occurrences. Defaults to False.
36 *
37 * @doc {heading: 'Operations', subheading: 'Reduction'}
38 */
39declare function denseBincount_<T extends Tensor1D | Tensor2D>(x: T | TensorLike, weights: T | TensorLike, size: number, binaryOutput?: boolean): T;
40export declare const denseBincount: typeof denseBincount_;
41export {};