1 | /**
|
2 | * @license
|
3 | * Copyright 2018 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/moving_average" />
|
18 | import { Scalar, Tensor } from '../tensor';
|
19 | import { TensorLike } from '../types';
|
20 | /**
|
21 | * Compute the moving average of a variable.
|
22 | *
|
23 | * Without zeroDebias, the moving average operation is defined by:
|
24 | * `v += delta`
|
25 | * where
|
26 | * `delta = (1 - decay) * (x - v)`
|
27 | *
|
28 | * With zeroDebias (default), the `delta` term is scaled to debias the
|
29 | * effect of the (assumed) zero-initialization of `v`.
|
30 | * `delta /= (1 - decay ^ step)`
|
31 | *
|
32 | * For more details on the zero-debiasing algorithm, see:
|
33 | * https://arxiv.org/abs/1412.6980
|
34 | *
|
35 | * Note that this function is completely stateless and does not keep track of
|
36 | * step count. The step count needs to be maintained by the caller and passed
|
37 | * in as `step`.
|
38 | *
|
39 | * @param v The current moving average value.
|
40 | * @param x New input value, must have the same shape and dtype as `v`.
|
41 | * @param decay The decay factor. Typical values are 0.95 and 0.99.
|
42 | * @param step Step count.
|
43 | * @param zeroDebias: Whether zeroDebias is to be performed (default: `true`).
|
44 | * @returns The new moving average value.
|
45 | *
|
46 | * @doc {heading: 'Operations', subheading: 'Moving Average'}
|
47 | */
|
48 | declare function movingAverage_<T extends Tensor>(v: T | TensorLike, x: T | TensorLike, decay: number | Scalar, step?: number | Scalar, zeroDebias?: boolean): T;
|
49 | export declare const movingAverage: typeof movingAverage_;
|
50 | export {};
|