Constant#

class seli.net.Constant(value)[source]#

Bases: Module

Return a constant value. Ignores all inputs.

Parameters:

value (jax.Array) – Constant value to return.

Attributes Summary

dtype

Return the dtype of the constant value.

shape

Return the shape of the constant value.

Methods Summary

__call__(*args, **kwargs)

Return the constant value, ignoring all inputs.

full([x, shape])

Initialize with a constant value.

random_normal(key, shape[, std])

Initialize with random normal values.

random_uniform(key, shape[, low, high])

Initialize with random uniform values.

Attributes Documentation

dtype#

Return the dtype of the constant value.

shape#

Return the shape of the constant value.

Methods Documentation

__call__(*args, **kwargs) Array[source]#

Return the constant value, ignoring all inputs.

classmethod full(x: float = 0.0, shape: tuple[int, ...] = ())[source]#

Initialize with a constant value.

Parameters:
  • x (float) – The constant value.

  • shape (tuple[int, ...]) – The shape of the array.

Returns:

The initialized module.

Return type:

Constant

classmethod random_normal(key: Key[Array, ''] | UInt32[Array, '2'], shape: tuple[int, ...], std: float = 1.0)[source]#

Initialize with random normal values.

Parameters:
  • key (PRNGKeyArray) – The key to use for random number generation.

  • shape (tuple[int, ...]) – The shape of the array.

  • std (float) – The standard deviation of the normal distribution.

Returns:

The initialized module.

Return type:

Constant

classmethod random_uniform(key: Key[Array, ''] | UInt32[Array, '2'], shape: tuple[int, ...], low: float = -1.0, high: float = 1.0)[source]#

Initialize with random uniform values.

Parameters:
  • key (PRNGKeyArray) – The key to use for random number generation.

  • shape (tuple[int, ...]) – The shape of the array.

  • low (float) – The lower bound of the uniform distribution.

  • high (float) – The upper bound of the uniform distribution.

Returns:

The initialized module.

Return type:

Constant