For each element of x, with probability rate, outputs 0, and otherwise
scales up the input by 1 / (1-rate). The scaling is such that the expected
sum is unchanged.
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. For example, if shape(x) = [k, l, m, n]
and noise_shape = [k, 1, 1, n], each batch and channel component will be
kept independently and each row and column will be kept or not kept together.
Args
x
A floating point tensor.
keep_prob
(deprecated) A deprecated alias for (1-rate).
noise_shape
A 1-D Tensor of type int32, representing the
shape for randomly generated keep/drop flags.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.nn.dropout\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/nn/dropout) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/nn_ops.py#L4178-L4229) |\n\nComputes dropout. (deprecated arguments)\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.nn.dropout`](/api_docs/python/tf/compat/v1/nn/dropout)\n\n\u003cbr /\u003e\n\n tf.nn.dropout(\n x, keep_prob=None, noise_shape=None, seed=None, name=None, rate=None\n )\n\n| **Warning:** SOME ARGUMENTS ARE DEPRECATED: `(keep_prob)`. They will be removed in a future version. Instructions for updating: Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.\n\nFor each element of `x`, with probability `rate`, outputs `0`, and otherwise\nscales up the input by `1 / (1-rate)`. The scaling is such that the expected\nsum is unchanged.\n\nBy default, each element is kept or dropped independently. If `noise_shape`\nis specified, it must be\n[broadcastable](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html)\nto the shape of `x`, and only dimensions with `noise_shape[i] == shape(x)[i]`\nwill make independent decisions. For example, if `shape(x) = [k, l, m, n]`\nand `noise_shape = [k, 1, 1, n]`, each batch and channel component will be\nkept independently and each row and column will be kept or not kept together.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------|\n| `x` | A floating point tensor. |\n| `keep_prob` | (deprecated) A deprecated alias for `(1-rate)`. |\n| `noise_shape` | A 1-D `Tensor` of type `int32`, representing the shape for randomly generated keep/drop flags. |\n| `seed` | A Python integer. Used to create random seeds. See [`tf.compat.v1.set_random_seed`](../../tf/random/set_random_seed) for behavior. |\n| `name` | A name for this operation (optional). |\n| `rate` | A scalar `Tensor` with the same type as `x`. The probability that each element of `x` is discarded. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A Tensor of the same shape of `x`. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|------------------------------------------------------------------------|\n| `ValueError` | If `rate` is not in `[0, 1)` or if `x` is not a floating point tensor. |\n\n\u003cbr /\u003e"]]