UNPKG

1.64 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 { Tensor1D } from '../tensor';
18import { TensorLike } from '../types';
19/**
20 * Outputs a vector with length `size` and the same dtype as `weights`.
21 *
22 * If `weights` are empty, then index `i` stores the number of times the value
23 * `i` is counted in `x`. If `weights` are non-empty, then index `i` stores the
24 * sum of the value in `weights` at each index where the corresponding value in
25 * `x` is `i`.
26 *
27 * Values in `x` outside of the range [0, size) are ignored.
28 *
29 * @param x The input int tensor, rank 1.
30 * @param weights The weights tensor, must have the same shape as x, or a
31 * length-0 Tensor, in which case it acts as all weights equal to 1.
32 * @param size Non-negative integer.
33 *
34 * @doc {heading: 'Operations', subheading: 'Reduction'}
35 */
36declare function bincount_<T extends Tensor1D>(x: T | TensorLike, weights: T | TensorLike, size: number): T;
37export declare const bincount: typeof bincount_;
38export {};