deepmd.utils.random#
Functions#
Module Contents#
- deepmd.utils.random.choice(a: numpy.ndarray | int, size: int | tuple[int, Ellipsis] | None = None, replace: bool = True, p: numpy.ndarray | None = None) numpy.ndarray | int[source]#
Generates a random sample from a given 1-D array.
- Parameters:
- a1-D array_like or
int If an ndarray, a random sample is generated from its elements. If an int, the random sample is generated as if it were np.arange(a)
- size
intortupleofints,optional Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.
- replacebool,
optional Whether the sample is with or without replacement. Default is True, meaning that a value of a can be selected multiple times.
- p1-D array_like,
optional The probabilities associated with each entry in a. If not given, the sample assumes a uniform distribution over all entries in a.
- a1-D array_like or
- Returns:
np.ndarrayarrays with results and their shapes
- deepmd.utils.random.random(size: int | tuple[int, Ellipsis] | None = None) float | numpy.ndarray[source]#
Return random floats in the half-open interval [0.0, 1.0).
- Parameters:
- size
Output shape.
- Returns:
np.ndarrayArrays with results and their shapes.
- deepmd.utils.random.seed(val: int | list[int] | None = None) None[source]#
Seed the generator.
- Parameters:
- val
int Seed.
- val
- deepmd.utils.random.shuffle(x: numpy.ndarray) None[source]#
Modify a sequence in-place by shuffling its contents.
- Parameters:
- x
np.ndarray The array or list to be shuffled.
- x