BatchNormalization - 1 vs 7#
Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.
BatchNormalization1 → BatchNormalization7
RENAMED
@@ -1 +1 @@
|
|
1
1
|
Carries out batch normalization as described in the paper
|
2
2
|
https://arxiv.org/abs/1502.03167. Depending on the mode it is being run,
|
3
3
|
there are multiple cases for the number of outputs, which we list below:
|
4
4
|
Output case #1: Y, mean, var, saved_mean, saved_var (training mode)
|
5
5
|
Output case #2: Y (test mode)
|
6
|
-
This operator has **optional** inputs/outputs. See ONNX <https://github.com/onnx/onnx/blob/master/docs/IR.md>_ for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.
|
7
6
|
**Attributes**
|
7
|
+
* **consumed_inputs** (required):
|
8
|
+
legacy optimization attribute.
|
8
9
|
* **epsilon**:
|
9
|
-
The epsilon value to use to avoid division by zero
|
10
|
+
The epsilon value to use to avoid division by zero, default is
|
11
|
+
1e-5f.
|
12
|
+
* **is_test**:
|
13
|
+
If set to nonzero, run spatial batch normalization in test mode,
|
14
|
+
default is 0.
|
10
15
|
* **momentum**:
|
11
16
|
Factor used in computing the running mean and variance.e.g.,
|
12
|
-
running_mean = running_mean * momentum + mean * (1 - momentum)
|
17
|
+
running_mean = running_mean * momentum + mean * (1 - momentum),
|
18
|
+
default is 0.9f.
|
13
19
|
* **spatial**:
|
14
|
-
If true, compute the mean and variance across
|
20
|
+
If true, compute the mean and variance across all spatial elements
|
15
|
-
false, compute the mean and variance across per feature
|
21
|
+
If false, compute the mean and variance across per feature.Default
|
16
|
-
|
22
|
+
is 1.
|
17
23
|
**Inputs**
|
18
24
|
* **X** (heterogeneous) - **T**:
|
25
|
+
The input 4-dimensional tensor of shape NCHW.
|
19
|
-
Input data tensor from the previous operator; dimensions for image
|
20
|
-
case are (N x C x H x W), where N is the batch size, C is the number
|
21
|
-
of channels, and H and W are the height and the width of the data.
|
22
|
-
For non image case, the dimensions are in the form of (N x C x D1 x
|
23
|
-
D2 ... Dn), where N is the batch size.
|
24
26
|
* **scale** (heterogeneous) - **T**:
|
25
|
-
If spatial is true, the dimension of scale is (C). If spatial is
|
26
|
-
|
27
|
+
The scale as a 1-dimensional tensor of size C to be applied to the
|
28
|
+
output.
|
27
29
|
* **B** (heterogeneous) - **T**:
|
28
|
-
If spatial is true, the dimension of bias is (C). If spatial is
|
29
|
-
|
30
|
+
The bias as a 1-dimensional tensor of size C to be applied to the
|
31
|
+
output.
|
30
32
|
* **mean** (heterogeneous) - **T**:
|
31
|
-
If spatial is true, the dimension of the running mean (training) or
|
32
|
-
the estimated mean (testing) is (C). If spatial is false, the
|
33
|
-
|
33
|
+
The running mean (training) or the estimated mean (testing) as a
|
34
|
-
|
34
|
+
1-dimensional tensor of size C.
|
35
35
|
* **var** (heterogeneous) - **T**:
|
36
|
+
The running variance (training) or the estimated variance (testing)
|
37
|
+
as a 1-dimensional tensor of size C.
|
36
|
-
If spatial is true, the dimension of the running variance(training)
|
37
|
-
or the estimated variance (testing) is (C). If spatial is false, the
|
38
|
-
dimensions of the running variance(training) or the estimated
|
39
|
-
variance (testing) are (C x D1 x ... x Dn).
|
40
38
|
**Outputs**
|
41
39
|
Between 1 and 5 outputs.
|
42
40
|
* **Y** (heterogeneous) - **T**:
|
43
|
-
The output tensor of the same shape as X
|
41
|
+
The output 4-dimensional tensor of the same shape as X.
|
44
42
|
* **mean** (optional, heterogeneous) - **T**:
|
45
|
-
The running mean after the BatchNormalization operator.
|
43
|
+
The running mean after the BatchNormalization operator. Must be in-
|
44
|
+
place with the input mean. Should not be used for testing.
|
46
45
|
* **var** (optional, heterogeneous) - **T**:
|
47
|
-
The running variance after the BatchNormalization operator.
|
46
|
+
The running variance after the BatchNormalization operator. Must be
|
47
|
+
in-place with the input var. Should not be used for testing.
|
48
48
|
* **saved_mean** (optional, heterogeneous) - **T**:
|
49
49
|
Saved mean used during training to speed up gradient computation.
|
50
|
+
Should not be used for testing.
|
50
51
|
* **saved_var** (optional, heterogeneous) - **T**:
|
51
52
|
Saved variance used during training to speed up gradient
|
52
|
-
computation.
|
53
|
+
computation. Should not be used for testing.
|
53
54
|
**Type Constraints**
|
54
55
|
* **T** in (
|
55
56
|
tensor(double),
|
56
57
|
tensor(float),
|
57
58
|
tensor(float16)
|
58
59
|
):
|
59
60
|
Constrain input and output types to float tensors.
|