UNPKG

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