tf.nn.dropout(x, keep_prob, noise_shape=None, seed=None, name=None)###
Computes dropout.
計(jì)算dropout率。
With probability keep_prob, outputs the input element scaled up by 1 / keep_prob, otherwise outputs 0. The scaling is so that the expected sum is unchanged.
存在概率keep_prob,則輸出通過1 / keep_prob放大的輸入,否則輸出0??s放以便期望總和不變。
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.
在默認(rèn)情況下,每個(gè)元素獨(dú)立安排保留或者丟棄。如果已經(jīng)指定noise_shape,則x的形狀必須為可廣播的。
Args:
x: A tensor.
keep_prob: A scalar Tensor with the same type as x. The probability that each element is kept.
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 set_random_seed for behavior.
name: A name for this operation (optional).
參數(shù):
x: 一個(gè)張量.
keep_prob: 一個(gè)跟x有相同類型的標(biāo)量張量. 決定每個(gè)元素被保留的幾率。
noise_shape: 一個(gè)int32類型的一維張量, 表示隨機(jī)生成保留 / 丟棄 狀態(tài)的形狀。
seed: 一個(gè)Python整數(shù),用來創(chuàng)建隨機(jī)種子。可參見set_random_seed的行為.
name: 操作的名字 (可選參數(shù)).
Returns:
A Tensor of the same shape of x.
返回值:
一個(gè)形狀跟x一樣的張量.
Raises:
ValueError: If keep_prob is not in (0, 1].
可引起的錯誤:
值錯誤: 如果keep_prob不在(0, 1]之內(nèi).