neurai.initializer package#

Submodules#

class neurai.initializer.initializer.BernoulliIniter(prob=0.0)#

Bases: Initializer

Initializes the UniformIniter.

Parameters:

prob (float) – the probability of the Bernoulli distribution, by default 0.

class neurai.initializer.initializer.ConstantIniter(value)#

Bases: Initializer

Initializes the ConstantIniter.

Parameters:

value (float) – the value to initialize the tensor with.

class neurai.initializer.initializer.Initializer(key=None)#

Bases: object

A base class for all initializer classes.

Parameters:

key (PRNGKey) – The PRNGKey used to generate the random numbers.

class neurai.initializer.initializer.KaimingUniformIniter(scale=2.0, mode='fan_in', distribution='uniform', in_axis=-2, out_axis=-1)#

Bases: VarianceScalingIniter

Initializes the VarianceScalingIniter.

Parameters:
  • scale (float) – the value to scale the variance.

  • mode (str) – indicates how to calculate the variance scaling factor.

  • distribution (str) – indicates the type of distribution to use.

  • in_axis (int) – indicates the input axis for computing the variance scaling factor, by default -2.

  • out_axis (int) – indicates the output axis for computing the variance scaling factor, by default -1.

class neurai.initializer.initializer.LecunNormalIniter(scale=1.0, mode='fan_in', distribution='truncated_normal', in_axis=-2, out_axis=-1)#

Bases: VarianceScalingIniter

Initializes the VarianceScalingIniter.

Parameters:
  • scale (float) – the value to scale the variance.

  • mode (str) – indicates how to calculate the variance scaling factor.

  • distribution (str) – indicates the type of distribution to use.

  • in_axis (int) – indicates the input axis for computing the variance scaling factor, by default -2.

  • out_axis (int) – indicates the output axis for computing the variance scaling factor, by default -1.

class neurai.initializer.initializer.NormalClipIniter(mean=0.0, stddev=1.0, minval=0.0, maxval=inf)#

Bases: Initializer

Initializes the NormalClipIniter.

Parameters:
  • mean (float) – the mean value of the normal distribution, by default 0.

  • stddev (float) – the standard deviation value of the normal distribution, by default 1.

  • minval (float) – the minimum value for clipping, by default 0.

  • maxval (float) – the maximum value for clipping, by default positive infinity.

class neurai.initializer.initializer.NormalIniter(mean=0.0, stddev=1.0)#

Bases: Initializer

Initializes the NormalIniter.

Parameters:
  • mean (float) – the mean value of the normal distribution, by default 0.

  • stddev (float) – the standard deviation value of the normal distribution, by default 1.

class neurai.initializer.initializer.PoissonIniter(lam=1.0)#

Bases: Initializer

Initializes the PoissonIniter.

Parameters:

lam (float) – lambda of poisson distribution, by default 1.0

class neurai.initializer.initializer.UniformIniter(minval=0.0, maxval=1.0)#

Bases: Initializer

Initializes the UniformIniter.

Parameters:
  • minval (float) – the minimum value of the uniform distribution, by default 0..

  • maxval (float) – the maximum value of the uniform distribution, by default 1..

class neurai.initializer.initializer.VarianceScalingIniter(scale, mode, distribution, in_axis=-2, out_axis=-1)#

Bases: Initializer

Initializes the VarianceScalingIniter.

Parameters:
  • scale (float) – the value to scale the variance.

  • mode (str) – indicates how to calculate the variance scaling factor.

  • distribution (str) – indicates the type of distribution to use.

  • in_axis (int) – indicates the input axis for computing the variance scaling factor, by default -2.

  • out_axis (int) – indicates the output axis for computing the variance scaling factor, by default -1.

class neurai.initializer.initializer.XavierUniformIniter(scale=1.0, mode='fan_avg', distribution='uniform', in_axis=-2, out_axis=-1)#

Bases: VarianceScalingIniter

Initializes the VarianceScalingIniter.

Parameters:
  • scale (float) – the value to scale the variance.

  • mode (str) – indicates how to calculate the variance scaling factor.

  • distribution (str) – indicates the type of distribution to use.

  • in_axis (int) – indicates the input axis for computing the variance scaling factor, by default -2.

  • out_axis (int) – indicates the output axis for computing the variance scaling factor, by default -1.

Module contents#