lab.random module

lab.random.choice[source]

Randomly choose from a tensor with replacement.

Parameters
  • a (tensor) – Tensor to choose from.

  • n (int, optional) – Number of samples. Defaults to 1.

Returns

Samples.

Return type

tensor

lab.random.rand[source]

Construct a U[0, 1] random tensor.

Parameters
  • dtype (dtype, optional) – Data type. Defaults to the default data type.

  • *shape (shape, optional) – Shape of the tensor. Defaults to ().

Returns

Random tensor.

Return type

tensor

lab.random.randn[source]

Construct a N(0, 1) random tensor.

Parameters
  • dtype (dtype, optional) – Data type. Defaults to the default data type.

  • *shape (shape, optional) – Shape of the tensor. Defaults to ().

Returns

Random tensor.

Return type

tensor

lab.random.set_random_seed[source]

Set the random seed for all frameworks.

Parameters

seed (int) – Seed.