Dropout#
Dropout - 13#
Version
name: Dropout (GitHub)
domain: main
since_version: 13
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 13.
Summary
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, output (floating-point tensor) and mask (optional Tensor<bool>). If training_mode is true then the output Y will be a random dropout; Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, the user can simply not pass training_mode input or set it to false.
output = scale * data * mask,
where
scale = 1. / (1. - ratio).
This operator has optional inputs/outputs. See ONNX 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.
Attributes
seed: (Optional) Seed to the random generator, if not specified we will auto generate one.
Inputs
Between 1 and 3 inputs.
data (heterogeneous) - T: The input data as Tensor.
ratio (optional, heterogeneous) - T1: The ratio of random dropout, with value in [0, 1). If this input was not set, or if it was set to 0, the output would be a simple copy of the input. If it’s non-zero, output will be a random dropout of the scaled input, which is typically the case during training. It is an optional value, if not specified it will default to 0.5.
training_mode (optional, heterogeneous) - T2: If set to true then it indicates dropout is being used for training. It is an optional value hence unless specified explicitly, it is false. If it is false, ratio is ignored and the operation mimics inference mode where nothing will be dropped from the input data and if mask is requested as output it will contain all ones.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T2: The output mask.
Type Constraints
T in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.
T1 in ( tensor(double), tensor(float), tensor(float16) ): Constrain input ‘ratio’ types to float tensors.
T2 in ( tensor(bool) ): Constrain output ‘mask’ types to boolean tensors.
Examples
default
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x'],
outputs=['y'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
y = dropout(x)
expect(node, inputs=[x], outputs=[y], name='test_dropout_default')
default_ratio
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r'],
outputs=['y'],
seed=seed
)
r = np.float32(0.1)
x = np.random.randn(3, 4, 5).astype(np.float32)
y = dropout(x, r)
expect(node, inputs=[x, r], outputs=[y], name='test_dropout_default_ratio')
default_mask
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x'],
outputs=['y', 'z'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
y, z = dropout(x, return_mask=True)
expect(node, inputs=[x], outputs=[y, z], name='test_dropout_default_mask')
default_mask_ratio
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r'],
outputs=['y', 'z'],
seed=seed
)
r = np.float32(0.1)
x = np.random.randn(3, 4, 5).astype(np.float32)
y, z = dropout(x, r, return_mask=True)
expect(node, inputs=[x, r], outputs=[y, z], name='test_dropout_default_mask_ratio')
# Training tests.
training_default
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.5)
t = np.bool_(True)
y = dropout(x, r, training_mode=t)
expect(node, inputs=[x, r, t], outputs=[y], name='test_training_dropout_default')
training_default_ratio_mask
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y', 'z'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.5)
t = np.bool_(True)
y, z = dropout(x, r, training_mode=t, return_mask=True)
expect(node, inputs=[x, r, t], outputs=[y, z], name='test_training_dropout_default_mask')
training
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.75)
t = np.bool_(True)
y = dropout(x, r, training_mode=t)
expect(node, inputs=[x, r, t], outputs=[y], name='test_training_dropout')
training_ratio_mask
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y', 'z'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.75)
t = np.bool_(True)
y, z = dropout(x, r, training_mode=t, return_mask=True)
expect(node, inputs=[x, r, t], outputs=[y, z], name='test_training_dropout_mask')
training_default_zero_ratio
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.0)
t = np.bool_(True)
y = dropout(x, r, training_mode=t)
expect(node, inputs=[x, r, t], outputs=[y], name='test_training_dropout_zero_ratio')
training_default_zero_ratio_mask
seed = np.int64(0)
node = onnx.helper.make_node(
'Dropout',
inputs=['x', 'r', 't'],
outputs=['y', 'z'],
seed=seed
)
x = np.random.randn(3, 4, 5).astype(np.float32)
r = np.float32(0.0)
t = np.bool_(True)
y, z = dropout(x, r, training_mode=t, return_mask=True)
expect(node, inputs=[x, r, t], outputs=[y, z], name='test_training_dropout_zero_ratio_mask')
# Old dropout tests
default_old
node = onnx.helper.make_node(
'Dropout',
inputs=['x'],
outputs=['y'],
)
x = np.array([-1, 0, 1]).astype(np.float32)
y = x
expect(node, inputs=[x], outputs=[y],
name='test_dropout_default_old', opset_imports=[helper.make_opsetid("", 11)])
random_old
node = onnx.helper.make_node(
'Dropout',
inputs=['x'],
outputs=['y'],
ratio=.2,
)
x = np.random.randn(3, 4, 5).astype(np.float32)
y = x
expect(node, inputs=[x], outputs=[y],
name='test_dropout_random_old', opset_imports=[helper.make_opsetid("", 11)])
Differences
0 | 0 | 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, | 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, |
1 | 1 | output (floating-point tensor) and mask (optional Tensor | output (floating-point tensor) and mask (optional Tensor |
2 | 2 | Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, | Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, |
3 | 3 | the user can simply not pass training_mode input or set it to false. | the user can simply not pass training_mode input or set it to false. |
4 | 4 | :: | :: |
5 | 5 |
|
|
6 | 6 | output = scale * data * mask, | output = scale * data * mask, |
7 | 7 |
|
|
8 | 8 | where | where |
9 | 9 | :: | :: |
10 | 10 |
|
|
11 | 11 | scale = 1. / (1. - ratio). | scale = 1. / (1. - ratio). |
12 | 12 |
|
|
13 | 13 | This operator has **optional** inputs/outputs. See ONNX | This operator has **optional** inputs/outputs. See ONNX |
14 | 14 |
|
|
15 | 15 | **Attributes** | **Attributes** |
16 | 16 |
|
|
17 | 17 | * **seed**: | * **seed**: |
18 | 18 | (Optional) Seed to the random generator, if not specified we will | (Optional) Seed to the random generator, if not specified we will |
19 | 19 | auto generate one. | auto generate one. |
20 | 20 |
|
|
21 | 21 | **Inputs** | **Inputs** |
22 | 22 |
|
|
23 | 23 | Between 1 and 3 inputs. | Between 1 and 3 inputs. |
24 | 24 |
|
|
25 | 25 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
26 | 26 | The input data as Tensor. | The input data as Tensor. |
27 | 27 | * **ratio** (optional, heterogeneous) - **T1**: | * **ratio** (optional, heterogeneous) - **T1**: |
28 | 28 | The ratio of random dropout, with value in [0, 1). If this input was | The ratio of random dropout, with value in [0, 1). If this input was |
29 | 29 | not set, or if it was set to 0, the output would be a simple copy of | not set, or if it was set to 0, the output would be a simple copy of |
30 | 30 | the input. If it's non-zero, output will be a random dropout of the | the input. If it's non-zero, output will be a random dropout of the |
31 | 31 | scaled input, which is typically the case during training. It is an | scaled input, which is typically the case during training. It is an |
32 | 32 | optional value, if not specified it will default to 0.5. | optional value, if not specified it will default to 0.5. |
33 | 33 | * **training_mode** (optional, heterogeneous) - **T2**: | * **training_mode** (optional, heterogeneous) - **T2**: |
34 | 34 | If set to true then it indicates dropout is being used for training. | If set to true then it indicates dropout is being used for training. |
35 | 35 | It is an optional value hence unless specified explicitly, it is | It is an optional value hence unless specified explicitly, it is |
36 | 36 | false. If it is false, ratio is ignored and the operation mimics | false. If it is false, ratio is ignored and the operation mimics |
37 | 37 | inference mode where nothing will be dropped from the input data and | inference mode where nothing will be dropped from the input data and |
38 | 38 | if mask is requested as output it will contain all ones. | if mask is requested as output it will contain all ones. |
39 | 39 |
|
|
40 | 40 | **Outputs** | **Outputs** |
41 | 41 |
|
|
42 | 42 | Between 1 and 2 outputs. | Between 1 and 2 outputs. |
43 | 43 |
|
|
44 | 44 | * **output** (heterogeneous) - **T**: | * **output** (heterogeneous) - **T**: |
45 | 45 | The output. | The output. |
46 | 46 | * **mask** (optional, heterogeneous) - **T2**: | * **mask** (optional, heterogeneous) - **T2**: |
47 | 47 | The output mask. | The output mask. |
48 | 48 |
|
|
49 | 49 | **Type Constraints** | **Type Constraints** |
50 | 50 |
|
|
51 | 51 | * **T** in ( | * **T** in ( |
52 | tensor(bfloat16), | ||
52 | 53 | tensor(double), | tensor(double), |
53 | 54 | tensor(float), | tensor(float), |
54 | 55 | tensor(float16) | tensor(float16) |
55 | 56 | ): | ): |
56 | 57 | Constrain input and output types to float tensors. | Constrain input and output types to float tensors. |
57 | 58 | * **T1** in ( | * **T1** in ( |
58 | 59 | tensor(double), | tensor(double), |
59 | 60 | tensor(float), | tensor(float), |
60 | 61 | tensor(float16) | tensor(float16) |
61 | 62 | ): | ): |
62 | 63 | Constrain input 'ratio' types to float tensors. | Constrain input 'ratio' types to float tensors. |
63 | 64 | * **T2** in ( | * **T2** in ( |
64 | 65 | tensor(bool) | tensor(bool) |
65 | 66 | ): | ): |
66 | 67 | Constrain output 'mask' types to boolean tensors. | Constrain output 'mask' types to boolean tensors. |
Dropout - 12#
Version
name: Dropout (GitHub)
domain: main
since_version: 12
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 12.
Summary
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, output (floating-point tensor) and mask (optional Tensor<bool>). If training_mode is true then the output Y will be a random dropout; Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, the user can simply not pass training_mode input or set it to false.
output = scale * data * mask,
where
scale = 1. / (1. - ratio).
This operator has optional inputs/outputs. See ONNX 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.
Attributes
seed: (Optional) Seed to the random generator, if not specified we will auto generate one.
Inputs
Between 1 and 3 inputs.
data (heterogeneous) - T: The input data as Tensor.
ratio (optional, heterogeneous) - T1: The ratio of random dropout, with value in [0, 1). If this input was not set, or if it was set to 0, the output would be a simple copy of the input. If it’s non-zero, output will be a random dropout of the scaled input, which is typically the case during training. It is an optional value, if not specified it will default to 0.5.
training_mode (optional, heterogeneous) - T2: If set to true then it indicates dropout is being used for training. It is an optional value hence unless specified explicitly, it is false. If it is false, ratio is ignored and the operation mimics inference mode where nothing will be dropped from the input data and if mask is requested as output it will contain all ones.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T2: The output mask.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.
T1 in ( tensor(double), tensor(float), tensor(float16) ): Constrain input ‘ratio’ types to float tensors.
T2 in ( tensor(bool) ): Constrain output ‘mask’ types to boolean tensors.
Differences
0 | 0 | Dropout takes one input floating tensor and produces two tensor outputs, |
|
1 | 1 | output (floating tensor) and mask (Tensor |
|
2 | in test mode or not, the output Y will either be a random dropout, or a simple | ||
3 | copy of the input. Note that our implementation of Dropout does scaling in | ||
4 | 2 | the training phase, so during testing nothing needs to be done. |
|
3 | the user can simply not pass training_mode input or set it to false. | ||
4 | :: | ||
5 |
| ||
6 | output = scale * data * mask, | ||
7 |
| ||
8 | where | ||
9 | :: | ||
10 |
| ||
11 | scale = 1. / (1. - ratio). | ||
12 |
| ||
5 | 13 | This operator has **optional** inputs/outputs. See ONNX | This operator has **optional** inputs/outputs. See ONNX |
6 | 14 |
|
|
7 | 15 | **Attributes** | **Attributes** |
8 | 16 |
|
|
17 | * **seed**: | ||
9 | 18 | * **ratio**: |
|
10 | 19 | The ratio of random dropout Default value is 0.5. |
|
11 | 20 |
|
|
12 | 21 | **Inputs** | **Inputs** |
13 | 22 |
|
|
23 | Between 1 and 3 inputs. | ||
24 |
| ||
14 | 25 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
26 | The input data as Tensor. | ||
27 | * **ratio** (optional, heterogeneous) - **T1**: | ||
28 | The ratio of random dropout, with value in [0, 1). If this input was | ||
29 | not set, or if it was set to 0, the output would be a simple copy of | ||
30 | the input. If it's non-zero, output will be a random dropout of the | ||
31 | scaled input, which is typically the case during training. It is an | ||
32 | optional value, if not specified it will default to 0.5. | ||
15 | 33 | The input data as Tensor. |
|
34 | If set to true then it indicates dropout is being used for training. | ||
35 | It is an optional value hence unless specified explicitly, it is | ||
36 | false. If it is false, ratio is ignored and the operation mimics | ||
37 | inference mode where nothing will be dropped from the input data and | ||
38 | if mask is requested as output it will contain all ones. | ||
16 | 39 |
|
|
17 | 40 | **Outputs** | **Outputs** |
18 | 41 |
|
|
19 | 42 | Between 1 and 2 outputs. | Between 1 and 2 outputs. |
20 | 43 |
|
|
21 | 44 | * **output** (heterogeneous) - **T**: | * **output** (heterogeneous) - **T**: |
22 | 45 | The output. | The output. |
23 | 46 | * **mask** (optional, heterogeneous) - **T1**: |
|
24 | 47 | The output mask. | The output mask. |
25 | 48 |
|
|
26 | 49 | **Type Constraints** | **Type Constraints** |
27 | 50 |
|
|
28 | 51 | * **T** in ( | * **T** in ( |
29 | 52 | tensor(double), | tensor(double), |
30 | 53 | tensor(float), | tensor(float), |
31 | 54 | tensor(float16) | tensor(float16) |
32 | 55 | ): | ): |
33 | 56 | Constrain input and output types to float tensors. | Constrain input and output types to float tensors. |
34 | 57 | * **T1** in ( | * **T1** in ( |
58 | tensor(double), | ||
59 | tensor(float), | ||
60 | tensor(float16) | ||
61 | ): | ||
62 | Constrain input 'ratio' types to float tensors. | ||
63 | * **T2** in ( | ||
35 | 64 | tensor(bool) | tensor(bool) |
36 | 65 | ): | ): |
37 | 66 | Constrain output mask types to boolean tensors. |
|
Dropout - 10#
Version
name: Dropout (GitHub)
domain: main
since_version: 10
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 10.
Summary
Dropout takes one input floating tensor and produces two tensor outputs, output (floating tensor) and mask (Tensor<bool>). Depending on whether it is in test mode or not, the output Y will either be a random dropout, or a simple copy of the input. Note that our implementation of Dropout does scaling in the training phase, so during testing nothing needs to be done. This operator has optional inputs/outputs. See ONNX 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.
Attributes
ratio: The ratio of random dropout Default value is
0.5
.
Inputs
data (heterogeneous) - T: The input data as Tensor.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T1: The output mask.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.
T1 in ( tensor(bool) ): Constrain output mask types to boolean tensors.
Differences
0 | 0 | Dropout takes one input data (Tensor<float>) and produces two Tensor outputs, |
|
1 | 1 | output (Tensor<float>) and mask (Tensor |
|
2 | 2 | test mode or not, the output Y will either be a random dropout, or a simple |
|
3 | 3 | copy of the input. Note that our implementation of Dropout does scaling in | copy of the input. Note that our implementation of Dropout does scaling in |
4 | 4 | the training phase, so during testing nothing needs to be done. | the training phase, so during testing nothing needs to be done. |
5 | 5 | This operator has **optional** inputs/outputs. See ONNX | This operator has **optional** inputs/outputs. See ONNX |
6 | 6 |
|
|
7 | 7 | **Attributes** | **Attributes** |
8 | 8 |
|
|
9 | 9 | * **ratio**: | * **ratio**: |
10 | 10 | The ratio of random dropout Default value is 0.5. | The ratio of random dropout Default value is 0.5. |
11 | 11 |
|
|
12 | 12 | **Inputs** | **Inputs** |
13 | 13 |
|
|
14 | 14 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
15 | 15 | The input data as Tensor. | The input data as Tensor. |
16 | 16 |
|
|
17 | 17 | **Outputs** | **Outputs** |
18 | 18 |
|
|
19 | 19 | Between 1 and 2 outputs. | Between 1 and 2 outputs. |
20 | 20 |
|
|
21 | 21 | * **output** (heterogeneous) - **T**: | * **output** (heterogeneous) - **T**: |
22 | 22 | The output. | The output. |
23 | 23 | * **mask** (optional, heterogeneous) - **T**: |
|
24 | 24 | The output mask. | The output mask. |
25 | 25 |
|
|
26 | 26 | **Type Constraints** | **Type Constraints** |
27 | 27 |
|
|
28 | 28 | * **T** in ( | * **T** in ( |
29 | 29 | tensor(double), | tensor(double), |
30 | 30 | tensor(float), | tensor(float), |
31 | 31 | tensor(float16) | tensor(float16) |
32 | 32 | ): | ): |
33 | 33 | Constrain input and output types to float tensors. | Constrain input and output types to float tensors. |
34 | * **T1** in ( | ||
35 | tensor(bool) | ||
36 | ): | ||
37 | Constrain output mask types to boolean tensors. |
Dropout - 7#
Version
name: Dropout (GitHub)
domain: main
since_version: 7
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 7.
Summary
Dropout takes one input data (Tensor<float>) and produces two Tensor outputs, output (Tensor<float>) and mask (Tensor<bool>). Depending on whether it is in test mode or not, the output Y will either be a random dropout, or a simple copy of the input. Note that our implementation of Dropout does scaling in the training phase, so during testing nothing needs to be done. This operator has optional inputs/outputs. See ONNX 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.
Attributes
ratio: The ratio of random dropout Default value is
0.5
.
Inputs
data (heterogeneous) - T: The input data as Tensor.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T: The output mask.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.
Differences
0 | 0 | Dropout takes one input data (Tensor | Dropout takes one input data (Tensor |
1 | 1 | output (Tensor | output (Tensor |
2 | 2 | test mode or not, the output Y will either be a random dropout, or a simple | test mode or not, the output Y will either be a random dropout, or a simple |
3 | 3 | copy of the input. Note that our implementation of Dropout does scaling in | copy of the input. Note that our implementation of Dropout does scaling in |
4 | 4 | the training phase, so during testing nothing needs to be done. | the training phase, so during testing nothing needs to be done. |
5 |
| ||
6 | **Attributes** | ||
7 |
| ||
8 | * **is_test**: | ||
9 | 5 | (int, default 0) if nonzero, run dropout in test mode where the |
|
6 |
| ||
10 | 7 | output is simply Y = X. Default value is 0. |
|
8 |
| ||
11 | 9 | * **ratio**: | * **ratio**: |
12 | 10 | (float, default 0.5) the ratio of random dropout Default value is 0.5. |
|
13 | 11 |
|
|
14 | 12 | **Inputs** | **Inputs** |
15 | 13 |
|
|
16 | 14 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
17 | 15 | The input data as Tensor. | The input data as Tensor. |
18 | 16 |
|
|
19 | 17 | **Outputs** | **Outputs** |
20 | 18 |
|
|
21 | 19 | Between 1 and 2 outputs. | Between 1 and 2 outputs. |
22 | 20 |
|
|
23 | 21 | * **output** (heterogeneous) - **T**: | * **output** (heterogeneous) - **T**: |
24 | 22 | The output. | The output. |
25 | 23 | * **mask** (optional, heterogeneous) - **T**: | * **mask** (optional, heterogeneous) - **T**: |
26 | 24 | The output mask. If is_test is nonzero, this output is not filled. |
|
27 | 25 |
|
|
28 | 26 | **Type Constraints** | **Type Constraints** |
29 | 27 |
|
|
30 | 28 | * **T** in ( | * **T** in ( |
31 | 29 | tensor(double), | tensor(double), |
32 | 30 | tensor(float), | tensor(float), |
33 | 31 | tensor(float16) | tensor(float16) |
34 | 32 | ): | ): |
35 | 33 | Constrain input and output types to float tensors. | Constrain input and output types to float tensors. |
Dropout - 6#
Version
name: Dropout (GitHub)
domain: main
since_version: 6
function: False
support_level: SupportType.COMMON
shape inference: True
This version of the operator has been available since version 6.
Summary
Dropout takes one input data (Tensor<float>) and produces two Tensor outputs, output (Tensor<float>) and mask (Tensor<bool>). Depending on whether it is in test mode or not, the output Y will either be a random dropout, or a simple copy of the input. Note that our implementation of Dropout does scaling in the training phase, so during testing nothing needs to be done.
Attributes
is_test: (int, default 0) if nonzero, run dropout in test mode where the output is simply Y = X. Default value is
0
.ratio: (float, default 0.5) the ratio of random dropout Default value is
0.5
.
Inputs
data (heterogeneous) - T: The input data as Tensor.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T: The output mask. If is_test is nonzero, this output is not filled.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.
Differences
0 | 0 | Dropout takes one input data (Tensor | Dropout takes one input data (Tensor |
1 | 1 | output (Tensor | output (Tensor |
2 | 2 | test mode or not, the output Y will either be a random dropout, or a simple | test mode or not, the output Y will either be a random dropout, or a simple |
3 | 3 | copy of the input. Note that our implementation of Dropout does scaling in | copy of the input. Note that our implementation of Dropout does scaling in |
4 | 4 | the training phase, so during testing nothing needs to be done. | the training phase, so during testing nothing needs to be done. |
5 | 5 |
|
|
6 | 6 | **Attributes** | **Attributes** |
7 | 7 |
|
|
8 | * **consumed_inputs**: | ||
9 | legacy optimization attribute. | ||
10 | 8 | * **is_test**: | * **is_test**: |
11 | 9 | (int, default 0) if nonzero, run dropout in test mode where the | (int, default 0) if nonzero, run dropout in test mode where the |
12 | 10 | output is simply Y = X. Default value is 0. | output is simply Y = X. Default value is 0. |
13 | 11 | * **ratio**: | * **ratio**: |
14 | 12 | (float, default 0.5) the ratio of random dropout Default value is 0.5. | (float, default 0.5) the ratio of random dropout Default value is 0.5. |
15 | 13 |
|
|
16 | 14 | **Inputs** | **Inputs** |
17 | 15 |
|
|
18 | 16 | * **data** (heterogeneous) - **T**: | * **data** (heterogeneous) - **T**: |
19 | 17 | The input data as Tensor. | The input data as Tensor. |
20 | 18 |
|
|
21 | 19 | **Outputs** | **Outputs** |
22 | 20 |
|
|
23 | 21 | Between 1 and 2 outputs. | Between 1 and 2 outputs. |
24 | 22 |
|
|
25 | 23 | * **output** (heterogeneous) - **T**: | * **output** (heterogeneous) - **T**: |
26 | 24 | The output. | The output. |
27 | 25 | * **mask** (optional, heterogeneous) - **T**: | * **mask** (optional, heterogeneous) - **T**: |
28 | 26 | The output mask. If is_test is nonzero, this output is not filled. | The output mask. If is_test is nonzero, this output is not filled. |
29 | 27 |
|
|
30 | 28 | **Type Constraints** | **Type Constraints** |
31 | 29 |
|
|
32 | 30 | * **T** in ( | * **T** in ( |
33 | 31 | tensor(double), | tensor(double), |
34 | 32 | tensor(float), | tensor(float), |
35 | 33 | tensor(float16) | tensor(float16) |
36 | 34 | ): | ): |
37 | 35 | Constrain input and output types to float tensors. | Constrain input and output types to float tensors. |
Dropout - 1#
Version
name: Dropout (GitHub)
domain: main
since_version: 1
function: False
support_level: SupportType.COMMON
shape inference: False
This version of the operator has been available since version 1.
Summary
Dropout takes one input data (Tensor<float>) and produces two Tensor outputs, output (Tensor<float>) and mask (Tensor<bool>). Depending on whether it is in test mode or not, the output Y will either be a random dropout, or a simple copy of the input. Note that our implementation of Dropout does scaling in the training phase, so during testing nothing needs to be done.
Attributes
consumed_inputs: legacy optimization attribute.
is_test: (int, default 0) if nonzero, run dropout in test mode where the output is simply Y = X. Default value is
0
.ratio: (float, default 0.5) the ratio of random dropout Default value is
0.5
.
Inputs
data (heterogeneous) - T: The input data as Tensor.
Outputs
Between 1 and 2 outputs.
output (heterogeneous) - T: The output.
mask (optional, heterogeneous) - T: The output mask. If is_test is nonzero, this output is not filled.
Type Constraints
T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.