class brainpy.dnn.Dropout(prob, mode=None, name=None)[source]#

A layer that stochastically ignores a subset of inputs each training step.

In training, to compensate for the fraction of input values dropped (rate), all surviving values are multiplied by 1 / (1 - rate).

This layer is active only during training (mode=brainpy.math.training_mode). In other circumstances it is a no-op.

  • prob (float) – Probability to keep element of the tensor.

  • mode (Optional[Mode]) – Mode. The computation mode of the object.

  • name (Optional[str]) – str. The name of the dynamic system.

update(x, fit=None)[source]#

The function to specify the updating rule.