Help protect the Great Barrier Reef with TensorFlow on Kaggle

# tf.nn.dropout

Computes dropout: randomly sets elements to zero to prevent overfitting.

See also: `tf.keras.layers.Dropout` for a dropout layer.

Dropout is useful for regularizing DNN models. Inputs elements are randomly set to zero (and the other elements are rescaled). This encourages each node to be independently useful, as it cannot rely on the output of other nodes.

More precisely: With probability `rate` elements of `x` are set to `0`. The remaining elemenst are scaled up by `1.0 / (1 - rate)`, so that the expected value is preserved.

````tf.random.set_seed(0)`
`x = tf.ones([3,5])`
`tf.nn.dropout(x, rate = 0.5).numpy()`
`array([[0., 0., 2., 2., 0.],`
`       [2., 0., 2., 2., 0.],`
`       [2., 2., 2., 0., 0.]], dtype=float32)`
`tf.nn.dropout(x, rate = 0.8).numpy()`
`array([[0., 0., 5., 0., 0.],`
`       [0., 0., 5., 0., 0.],`
`       [5., 0., 0., 5., 0.]], dtype=float32)`
```

If rate is set to `0` the input is returned, unchanged:

````tf.nn.dropout(x, rate = 0.0) is x`
`True`
```

By default, each element is kept or dropped independently. If `noise_shape` is specified, it must be broadcastable to the shape of `x`, and only dimensions with `noise_shape[i] == shape(x)[i]` will make independent decisions. This is useful for dropping whole channels from an image or sequence. For example:

````x = tf.ones([3,10])`
`tf.nn.dropout(x, rate = 2/3, noise_shape=[1,10]).numpy()`
`array([[0., 3., 0., 3., 0., 0., 3., 0., 0., 3.],`
`       [0., 3., 0., 3., 0., 0., 3., 0., 0., 3.],`
`       [0., 3., 0., 3., 0., 0., 3., 0., 0., 3.]], dtype=float32)`
```

`x` A floating point tensor.
`rate` A scalar `Tensor` with the same type as x. The probability that each element is dropped. For example, setting rate=0.1 would drop 10% of input elements.
`noise_shape` A 1-D `Tensor` of type `int32`, representing the shape for randomly generated keep/drop flags.
`seed` A Python integer. Used to create random seeds. See `tf.random.set_seed` for behavior.
`name` A name for this operation (optional).

A Tensor of the same shape of `x`.

`ValueError` If `rate` is not in `[0, 1)` or if `x` is not a floating point tensor. `rate=1` is disallowed, because theoutput would be all zeros, which is likely not what was intended.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]