deepmd.tf.utils.random#
Alias for backward compatibility.
Functions#
Module Contents#
- deepmd.tf.utils.random.choice(a: numpy.ndarray | int, size: int | tuple[int, Ellipsis] | None = None, replace: bool = True, p: numpy.ndarray | None = None)[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
int
ortuple
of
ints
,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.ndarray
arrays with results and their shapes
- deepmd.tf.utils.random.random(size=None)[source]#
Return random floats in the half-open interval [0.0, 1.0).
- Parameters:
- size
Output shape.
- Returns:
np.ndarray
Arrays with results and their shapes.
- deepmd.tf.utils.random.seed(val: int | None = None) None [source]#
Seed the generator.
- Parameters:
- val
int
Seed.
- val
- deepmd.tf.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