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

00Dropout 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,
11output (floating-point tensor) and mask (optional Tensor). If training_mode is true then the output Y will be a random dropout;output (floating-point tensor) and mask (optional Tensor). If training_mode is true then the output Y will be a random dropout;
22Note 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,
33the 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.
44::::
55
66 output = scale * data * mask, output = scale * data * mask,
77
88wherewhere
99::::
1010
1111 scale = 1. / (1. - ratio). scale = 1. / (1. - ratio).
1212
1313This 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.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.
1414
1515**Attributes****Attributes**
1616
1717* **seed**:* **seed**:
1818 (Optional) Seed to the random generator, if not specified we will (Optional) Seed to the random generator, if not specified we will
1919 auto generate one. auto generate one.
2020
2121**Inputs****Inputs**
2222
2323Between 1 and 3 inputs.Between 1 and 3 inputs.
2424
2525* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
2626 The input data as Tensor. The input data as Tensor.
2727* **ratio** (optional, heterogeneous) - **T1**:* **ratio** (optional, heterogeneous) - **T1**:
2828 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
2929 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
3030 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
3131 scaled input, which is typically the case during training. It is an scaled input, which is typically the case during training. It is an
3232 optional value, if not specified it will default to 0.5. optional value, if not specified it will default to 0.5.
3333* **training_mode** (optional, heterogeneous) - **T2**:* **training_mode** (optional, heterogeneous) - **T2**:
3434 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.
3535 It is an optional value hence unless specified explicitly, it is It is an optional value hence unless specified explicitly, it is
3636 false. If it is false, ratio is ignored and the operation mimics false. If it is false, ratio is ignored and the operation mimics
3737 inference mode where nothing will be dropped from the input data and inference mode where nothing will be dropped from the input data and
3838 if mask is requested as output it will contain all ones. if mask is requested as output it will contain all ones.
3939
4040**Outputs****Outputs**
4141
4242Between 1 and 2 outputs.Between 1 and 2 outputs.
4343
4444* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
4545 The output. The output.
4646* **mask** (optional, heterogeneous) - **T2**:* **mask** (optional, heterogeneous) - **T2**:
4747 The output mask. The output mask.
4848
4949**Type Constraints****Type Constraints**
5050
5151* **T** in (* **T** in (
52 tensor(bfloat16),
5253 tensor(double), tensor(double),
5354 tensor(float), tensor(float),
5455 tensor(float16) tensor(float16)
5556 ): ):
5657 Constrain input and output types to float tensors. Constrain input and output types to float tensors.
5758* **T1** in (* **T1** in (
5859 tensor(double), tensor(double),
5960 tensor(float), tensor(float),
6061 tensor(float16) tensor(float16)
6162 ): ):
6263 Constrain input 'ratio' types to float tensors. Constrain input 'ratio' types to float tensors.
6364* **T2** in (* **T2** in (
6465 tensor(bool) tensor(bool)
6566 ): ):
6667 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

00Dropout takes one input floating tensor and 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,
11output (floating tensor) and mask (Tensor). Depending on whether it isoutput (floating-point tensor) and mask (optional Tensor). If training_mode is true then the output Y will be a random dropout;
2in test mode or not, the output Y will either be a random dropout, or a simple
3copy of the input. Note that our implementation of Dropout does scaling in
42the training phase, so during testing nothing needs to be done.Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode,
3the user can simply not pass training_mode input or set it to false.
4::
5
6 output = scale * data * mask,
7
8where
9::
10
11 scale = 1. / (1. - ratio).
12
513This 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.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.
614
715**Attributes****Attributes**
816
17* **seed**:
918* **ratio**: (Optional) Seed to the random generator, if not specified we will
1019 The ratio of random dropout Default value is 0.5. auto generate one.
1120
1221**Inputs****Inputs**
1322
23Between 1 and 3 inputs.
24
1425* **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.
1533 The input data as Tensor.* **training_mode** (optional, heterogeneous) - **T2**:
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.
1639
1740**Outputs****Outputs**
1841
1942Between 1 and 2 outputs.Between 1 and 2 outputs.
2043
2144* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
2245 The output. The output.
2346* **mask** (optional, heterogeneous) - **T1**:* **mask** (optional, heterogeneous) - **T2**:
2447 The output mask. The output mask.
2548
2649**Type Constraints****Type Constraints**
2750
2851* **T** in (* **T** in (
2952 tensor(double), tensor(double),
3053 tensor(float), tensor(float),
3154 tensor(float16) tensor(float16)
3255 ): ):
3356 Constrain input and output types to float tensors. Constrain input and output types to float tensors.
3457* **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 (
3564 tensor(bool) tensor(bool)
3665 ): ):
3766 Constrain output mask types to boolean tensors. 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

00Dropout takes one input data (Tensor<float>) and produces two Tensor outputs,Dropout takes one input floating tensor and produces two tensor outputs,
11output (Tensor<float>) and mask (Tensor). Depending on whether it is inoutput (floating tensor) and mask (Tensor). Depending on whether it is
22test mode or not, the output Y will either be a random dropout, or a simplein test mode or not, the output Y will either be a random dropout, or a simple
33copy of the input. Note that our implementation of Dropout does scaling incopy of the input. Note that our implementation of Dropout does scaling in
44the training phase, so during testing nothing needs to be done.the training phase, so during testing nothing needs to be done.
55This 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.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.
66
77**Attributes****Attributes**
88
99* **ratio**:* **ratio**:
1010 The ratio of random dropout Default value is 0.5. The ratio of random dropout Default value is 0.5.
1111
1212**Inputs****Inputs**
1313
1414* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
1515 The input data as Tensor. The input data as Tensor.
1616
1717**Outputs****Outputs**
1818
1919Between 1 and 2 outputs.Between 1 and 2 outputs.
2020
2121* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
2222 The output. The output.
2323* **mask** (optional, heterogeneous) - **T**:* **mask** (optional, heterogeneous) - **T1**:
2424 The output mask. The output mask.
2525
2626**Type Constraints****Type Constraints**
2727
2828* **T** in (* **T** in (
2929 tensor(double), tensor(double),
3030 tensor(float), tensor(float),
3131 tensor(float16) tensor(float16)
3232 ): ):
3333 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

00Dropout takes one input data (Tensor) and produces two Tensor outputs,Dropout takes one input data (Tensor) and produces two Tensor outputs,
11output (Tensor) and mask (Tensor). Depending on whether it is inoutput (Tensor) and mask (Tensor). Depending on whether it is in
22test mode or not, the output Y will either be a random dropout, or a simpletest mode or not, the output Y will either be a random dropout, or a simple
33copy of the input. Note that our implementation of Dropout does scaling incopy of the input. Note that our implementation of Dropout does scaling in
44the 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**:
95 (int, default 0) if nonzero, run dropout in test mode where theThis 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.
6
107 output is simply Y = X. Default value is 0.**Attributes**
8
119* **ratio**:* **ratio**:
1210 (float, default 0.5) the ratio of random dropout Default value is 0.5. The ratio of random dropout Default value is 0.5.
1311
1412**Inputs****Inputs**
1513
1614* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
1715 The input data as Tensor. The input data as Tensor.
1816
1917**Outputs****Outputs**
2018
2119Between 1 and 2 outputs.Between 1 and 2 outputs.
2220
2321* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
2422 The output. The output.
2523* **mask** (optional, heterogeneous) - **T**:* **mask** (optional, heterogeneous) - **T**:
2624 The output mask. If is_test is nonzero, this output is not filled. The output mask.
2725
2826**Type Constraints****Type Constraints**
2927
3028* **T** in (* **T** in (
3129 tensor(double), tensor(double),
3230 tensor(float), tensor(float),
3331 tensor(float16) tensor(float16)
3432 ): ):
3533 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

00Dropout takes one input data (Tensor) and produces two Tensor outputs,Dropout takes one input data (Tensor) and produces two Tensor outputs,
11output (Tensor) and mask (Tensor). Depending on whether it is inoutput (Tensor) and mask (Tensor). Depending on whether it is in
22test mode or not, the output Y will either be a random dropout, or a simpletest mode or not, the output Y will either be a random dropout, or a simple
33copy of the input. Note that our implementation of Dropout does scaling incopy of the input. Note that our implementation of Dropout does scaling in
44the training phase, so during testing nothing needs to be done.the training phase, so during testing nothing needs to be done.
55
66**Attributes****Attributes**
77
8* **consumed_inputs**:
9 legacy optimization attribute.
108* **is_test**:* **is_test**:
119 (int, default 0) if nonzero, run dropout in test mode where the (int, default 0) if nonzero, run dropout in test mode where the
1210 output is simply Y = X. Default value is 0. output is simply Y = X. Default value is 0.
1311* **ratio**:* **ratio**:
1412 (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.
1513
1614**Inputs****Inputs**
1715
1816* **data** (heterogeneous) - **T**:* **data** (heterogeneous) - **T**:
1917 The input data as Tensor. The input data as Tensor.
2018
2119**Outputs****Outputs**
2220
2321Between 1 and 2 outputs.Between 1 and 2 outputs.
2422
2523* **output** (heterogeneous) - **T**:* **output** (heterogeneous) - **T**:
2624 The output. The output.
2725* **mask** (optional, heterogeneous) - **T**:* **mask** (optional, heterogeneous) - **T**:
2826 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.
2927
3028**Type Constraints****Type Constraints**
3129
3230* **T** in (* **T** in (
3331 tensor(double), tensor(double),
3432 tensor(float), tensor(float),
3533 tensor(float16) tensor(float16)
3634 ): ):
3735 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.