Dropout - 7 vs 12#
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.
- Dropout7 → Dropout12 +9 -41
Dropout7 → Dropout12
RENAMED
@@ -1 +1 @@
|
|
1
|
+
Dropout takes one input data (Tensor<float>) and produces two Tensor outputs,
|
2
|
+
output (Tensor<float>) and mask (Tensor<bool>). Depending on whether it is in
|
3
|
+
test mode or not, the output Y will either be a random dropout, or a simple
|
4
|
+
copy of the input. Note that our implementation of Dropout does scaling in
|
5
|
+
the training phase, so during testing nothing needs to be done.
|
1
|
-
Dropout takes an input floating-point tensor, an optional input ratio (floating-point scalar) and an optional input training_mode (boolean scalar). It produces two tensor outputs,
|
2
|
-
output (floating-point tensor) and mask (optional Tensor<bool>). If training_mode is true then the output Y will be a random dropout;
|
3
|
-
Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode,
|
4
|
-
the user can simply not pass training_mode input or set it to false.
|
5
|
-
::
|
6
|
-
|
7
|
-
output = scale * data * mask,
|
8
|
-
|
9
|
-
where
|
10
|
-
::
|
11
|
-
|
12
|
-
scale = 1. / (1. - ratio).
|
13
|
-
|
14
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.
|
15
7
|
**Attributes**
|
8
|
+
* **ratio**:
|
9
|
+
The ratio of random dropout
|
16
|
-
* **seed**:
|
17
|
-
(Optional) Seed to the random generator, if not specified we will
|
18
|
-
auto generate one.
|
19
10
|
**Inputs**
|
20
|
-
Between 1 and 3 inputs.
|
21
|
-
|
22
11
|
* **data** (heterogeneous) - **T**:
|
23
12
|
The input data as Tensor.
|
24
|
-
* **ratio** (optional, heterogeneous) - **T1**:
|
25
|
-
The ratio of random dropout, with value in [0, 1). If this input was
|
26
|
-
not set, or if it was set to 0, the output would be a simple copy of
|
27
|
-
the input. If it's non-zero, output will be a random dropout of the
|
28
|
-
scaled input, which is typically the case during training. It is an
|
29
|
-
optional value, if not specified it will default to 0.5.
|
30
|
-
* **training_mode** (optional, heterogeneous) - **T2**:
|
31
|
-
If set to true then it indicates dropout is being used for training.
|
32
|
-
It is an optional value hence unless specified explicitly, it is
|
33
|
-
false. If it is false, ratio is ignored and the operation mimics
|
34
|
-
inference mode where nothing will be dropped from the input data and
|
35
|
-
if mask is requested as output it will contain all ones.
|
36
13
|
**Outputs**
|
37
14
|
Between 1 and 2 outputs.
|
38
15
|
* **output** (heterogeneous) - **T**:
|
39
16
|
The output.
|
40
|
-
* **mask** (optional, heterogeneous) - **
|
17
|
+
* **mask** (optional, heterogeneous) - **T**:
|
41
18
|
The output mask.
|
42
19
|
**Type Constraints**
|
43
20
|
* **T** in (
|
44
21
|
tensor(double),
|
45
22
|
tensor(float),
|
46
23
|
tensor(float16)
|
47
24
|
):
|
48
|
-
Constrain input and output types to float tensors
|
25
|
+
Constrain input and output types to float tensors.- * **T1** in (
|
49
|
-
tensor(double),
|
50
|
-
tensor(float),
|
51
|
-
tensor(float16)
|
52
|
-
):
|
53
|
-
Constrain input 'ratio' types to float tensors.
|
54
|
-
* **T2** in (
|
55
|
-
tensor(bool)
|
56
|
-
):
|
57
|
-
Constrain output 'mask' types to boolean tensors.
|