UNPKG

1.74 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 { DataType, Rank, ShapeMap } from '../types';
19/**
20 * Creates a `tf.Tensor` with values sampled from a uniform distribution.
21 *
22 * The generated values follow a uniform distribution in the range [minval,
23 * maxval). The lower bound minval is included in the range, while the upper
24 * bound maxval is excluded.
25 *
26 * ```js
27 * tf.randomUniform([2, 2]).print();
28 * ```
29 *
30 * @param shape An array of integers defining the output tensor shape.
31 * @param minval The lower bound on the range of random values to generate.
32 * Defaults to 0.
33 * @param maxval The upper bound on the range of random values to generate.
34 * Defaults to 1.
35 * @param dtype The data type of the output tensor. Defaults to 'float32'.
36 *
37 * @doc {heading: 'Tensors', subheading: 'Random'}
38 */
39declare function randomUniform_<R extends Rank>(shape: ShapeMap[R], minval?: number, maxval?: number, dtype?: DataType, seed?: number | string): Tensor<R>;
40export declare const randomUniform: typeof randomUniform_;
41export {};