deepxde.nn

deepxde.nn.activations module

deepxde.nn.activations.get(identifier)[source]

Returns function.

Parameters:

identifier – Function or string (ELU, GELU, ReLU, SELU, Sigmoid, SiLU, sin, Swish, tanh).

Returns:

Function corresponding to the input string or input function.

deepxde.nn.activations.layer_wise_locally_adaptive(activation, n=1)[source]

Layer-wise locally adaptive activation functions (L-LAAF).

Examples:

To define a L-LAAF ReLU with the scaling factor n = 10:

n = 10
activation = f"LAAF-{n} relu"  # "LAAF-10 relu"

References

A. D. Jagtap, K. Kawaguchi, & G. E. Karniadakis. Locally adaptive activation functions with slope recovery for deep and physics-informed neural networks. Proceedings of the Royal Society A, 476(2239), 20200334, 2020.

deepxde.nn.activations.linear(x)[source]

deepxde.nn.initializers module

class deepxde.nn.initializers.VarianceScalingStacked(scale=1.0, mode='fan_in', distribution='truncated_normal', seed=None)[source]

Bases: object

Initializer capable of adapting its scale to the shape of weights tensors.

With distribution=”truncated_normal” or “untruncated_normal”, samples are drawn from a truncated/untruncated normal distribution with a mean of zero and a standard deviation (after truncation, if used) stddev = sqrt(scale / n) where n is:

  • number of input units in the weight tensor, if mode = “fan_in”

  • number of output units, if mode = “fan_out”

  • average of the numbers of input and output units, if mode = “fan_avg”

With distribution=”uniform”, samples are drawn from a uniform distribution within [-limit, limit], with limit = sqrt(3 * scale / n).

Parameters:
  • scale – Scaling factor (positive float).

  • mode – One of “fan_in”, “fan_out”, “fan_avg”.

  • distribution – Random distribution to use. One of “normal”, “uniform”.

  • seed – A Python integer. Used to create random seeds. See tf.set_random_seed for behavior.

  • dtype – Default data type, used if no dtype argument is provided when calling the initializer. Only floating point types are supported.

Raises:

ValueError – In case of an invalid value for the “scale”, mode” or “distribution” arguments.

deepxde.nn.initializers.get(identifier)[source]

Retrieve an initializer by the identifier.

Parameters:

identifier – String that contains the initializer name or an initializer function.

Returns:

Initializer instance base on the input identifier.

deepxde.nn.regularizers module

deepxde.nn.regularizers.get(identifier)[source]