TruncatedNormal

Contents

TruncatedNormal#

class brainpy.initialize.TruncatedNormal(loc=0.0, scale=1.0, lower=-2.0, upper=2.0, seed=None)[source]#

Initialize weights with truncated normal distribution.

Parameters:
  • loc (float, ndarray) – Mean (“centre”) of the distribution before truncating. Note that the mean of the truncated distribution will not be exactly equal to loc.

  • scale (float) – The standard deviation of the normal distribution before truncating.

  • lower (float, ndarray) – A float or array of floats representing the lower bound for truncation. Must be broadcast-compatible with upper. Defaults to -2.0 (2-sigma truncation); pass None for an unbounded (-inf) lower bound.

  • upper (float, ndarray) – A float or array of floats representing the upper bound for truncation. Must be broadcast-compatible with lower. Defaults to 2.0 (2-sigma truncation); pass None for an unbounded (+inf) upper bound.