UNPKG

2.03 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, Tensor1D } from '../tensor';
18import { Rank, TensorLike } from '../types';
19/**
20 * Batch normalization.
21 *
22 * As described in
23 * [http://arxiv.org/abs/1502.03167](http://arxiv.org/abs/1502.03167).
24 *
25 * Mean, variance, scale, and offset can be of two shapes:
26 * - The same shape as the input.
27 * - In the common case, the depth dimension is the last dimension of x, so
28 * the values would be an `tf.Tensor1D` of shape [depth].
29 *
30 * Also available are stricter rank-specific methods with the same signature
31 * as this method that assert that parameters passed are of given rank
32 * - `tf.batchNorm2d`
33 * - `tf.batchNorm3d`
34 * - `tf.batchNorm4d`
35 *
36 * @param x The input Tensor.
37 * @param mean A mean Tensor.
38 * @param variance A variance Tensor.
39 * @param offset An offset Tensor.
40 * @param scale A scale Tensor.
41 * @param varianceEpsilon A small float number to avoid dividing by 0.
42 *
43 * @doc {heading: 'Operations', subheading: 'Normalization'}
44 */
45declare function batchNorm_<R extends Rank>(x: Tensor<R> | TensorLike, mean: Tensor<R> | Tensor1D | TensorLike, variance: Tensor<R> | Tensor1D | TensorLike, offset?: Tensor<R> | Tensor1D | TensorLike, scale?: Tensor<R> | Tensor1D | TensorLike, varianceEpsilon?: number): Tensor<R>;
46export declare const batchNorm: typeof batchNorm_;
47export {};