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/multinomial" />
|
18 | import { Tensor1D, Tensor2D } from '../tensor';
|
19 | import { TensorLike } from '../types';
|
20 | /**
|
21 | * Creates a `tf.Tensor` with values drawn from a multinomial distribution.
|
22 | *
|
23 | * ```js
|
24 | * const probs = tf.tensor([.75, .25]);
|
25 | * tf.multinomial(probs, 3).print();
|
26 | * ```
|
27 | *
|
28 | * @param logits 1D array with unnormalized log-probabilities, or
|
29 | * 2D array of shape `[batchSize, numOutcomes]`. See the `normalized`
|
30 | * parameter.
|
31 | * @param numSamples Number of samples to draw for each row slice.
|
32 | * @param seed The seed number.
|
33 | * @param normalized Whether the provided `logits` are normalized true
|
34 | * probabilities (sum to 1). Defaults to false.
|
35 | * @return 1D array of shape `[numSamples]`, or 2D array of shape
|
36 | * `[batchSize, numSamples]`, depending on the rank of the input.
|
37 | *
|
38 | * @doc {heading: 'Tensors', subheading: 'Random'}
|
39 | */
|
40 | declare function multinomial_(logits: Tensor1D | Tensor2D | TensorLike, numSamples: number, seed?: number, normalized?: boolean): Tensor1D | Tensor2D;
|
41 | export declare const multinomial: typeof multinomial_;
|
42 | export {};
|