|
Cytnx v1.0.0
|
The randomization related functions. More...
Functions | |
| void | normal_ (cytnx::Storage &Sin, const double &mean, const double &std, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a Storage with normal distributon. | |
| void | uniform_ (cytnx::Storage &Sin, const double &low=0, const double &high=1, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a Storage with uniform distributon. | |
| void | normal_ (cytnx::Tensor &Tin, const double &mean, const double &std, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a Tensor with normal distributon. | |
| void | uniform_ (cytnx::Tensor &Tin, const double &low=0, const double &high=1, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a Tensor with uniform distributon. | |
| void | normal_ (cytnx::UniTensor &Tin, const double &mean, const double &std, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a UniTensor with normal distributon. | |
| void | uniform_ (cytnx::UniTensor &Tin, const double &low=0, const double &high=1, const unsigned int &seed=__static_random_device()) |
| Randomize the memory of a UniTensor with uniform distributon. | |
| Tensor | normal (const cytnx_uint64 &Nelem, const double &mean, const double &std, const int &device=Device.cpu, const unsigned int &seed=__static_random_device(), const unsigned int &dtype=Type.Double) |
| create an Tensor with all the elements are initialized with normal distribution | |
| Tensor | normal (const std::vector< cytnx_uint64 > &Nelem, const double &mean, const double &std, const int &device=Device.cpu, const unsigned int &seed=__static_random_device(), const unsigned int &dtype=Type.Double) |
| create an Tensor with all the elements are initialized with normal distribution | |
| Tensor | uniform (const cytnx_uint64 &Nelem, const double &low, const double &high, const int &device=Device.cpu, const unsigned int &seed=__static_random_device(), const unsigned int &dtype=Type.Double) |
| create an Tensor with all the elements are initialized with uniform distribution | |
| Tensor | uniform (const std::vector< cytnx_uint64 > &Nelem, const double &low, const double &high, const int &device=Device.cpu, const unsigned int &seed=__static_random_device(), const unsigned int &dtype=Type.Double) |
| create an Tensor with all the elements are initialized with uniform distribution | |
Variables | |
| std::random_device | __static_random_device |
The randomization related functions.
| Tensor cytnx::random::normal | ( | const cytnx_uint64 & | Nelem, |
| const double & | mean, | ||
| const double & | std, | ||
| const int & | device = Device.cpu, |
||
| const unsigned int & | seed = __static_random_device(), |
||
| const unsigned int & | dtype = Type.Double |
||
| ) |
create an Tensor with all the elements are initialized with normal distribution
| [in] | Nelem | the number of elements |
| [in] | mean | the mean of the normal distribution |
| [in] | std | the standard deviation \( \sigma \) of a normal distribution. |
| [in] | device | the device that the Tensor is put on. It can be any device defined in |
| [in] | seed | the seed for the random generator. [Default] using device entropy |
| [in] | dtype | the data type of the Tensor. [Default] cytnx::Type.Double cytnx::Device |
| seed | the seed for the random generator. [Default] using device entropy |
| Tensor cytnx::random::normal | ( | const std::vector< cytnx_uint64 > & | Nelem, |
| const double & | mean, | ||
| const double & | std, | ||
| const int & | device = Device.cpu, |
||
| const unsigned int & | seed = __static_random_device(), |
||
| const unsigned int & | dtype = Type.Double |
||
| ) |
create an Tensor with all the elements are initialized with normal distribution
| [in] | Nelem | the shape of the Tensor |
| [in] | mean | the mean of the normal distribution |
| [in] | std | the standard deviation (sigma) of the normal distribution |
| [in] | device | the device that the Tensor is put on. It can be any device defined in cytnx::Device |
| [in] | seed | the seed for the random generator. [Default] using device entropy |
| [in] | dtype | the data type of the Tensor. [Default] cytnx::Type.Double |
| void cytnx::random::normal_ | ( | cytnx::Storage & | Sin, |
| const double & | mean, | ||
| const double & | std, | ||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a Storage with normal distributon.
| [in] | Sin | a Storage |
| [in] | mean | the mean of a normal distribution |
| [in] | std | the standard deviation \( \sigma \) of a normal distribution. |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
| void cytnx::random::normal_ | ( | cytnx::Tensor & | Tin, |
| const double & | mean, | ||
| const double & | std, | ||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a Tensor with normal distributon.
| [in] | Tin | a Tensor |
| [in] | mean | the mean of a normal distribution |
| [in] | std | the standard deviation \( \sigma \) of a normal distribution. |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
| void cytnx::random::normal_ | ( | cytnx::UniTensor & | Tin, |
| const double & | mean, | ||
| const double & | std, | ||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a UniTensor with normal distributon.
| [in] | Tin | a UniTensor |
| [in] | mean | the mean of a normal distribution |
| [in] | std | the standard deviation \( \sigma \) of a normal distribution. |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
| Tensor cytnx::random::uniform | ( | const cytnx_uint64 & | Nelem, |
| const double & | low, | ||
| const double & | high, | ||
| const int & | device = Device.cpu, |
||
| const unsigned int & | seed = __static_random_device(), |
||
| const unsigned int & | dtype = Type.Double |
||
| ) |
create an Tensor with all the elements are initialized with uniform distribution
| [in] | Nelem | the number of elements |
| [in] | low | the lower-bound of range |
| [in] | high | the upper-bound of range |
| [in] | device | the device that the Tensor is put on. It can be any device defined in cytnx::Device |
| [in] | seed | the seed for the random generator. [Default] using device entropy |
| [in] | dtype | the data type of the Tensor. [Default] cytnx::Type.Double |
| Tensor cytnx::random::uniform | ( | const std::vector< cytnx_uint64 > & | Nelem, |
| const double & | low, | ||
| const double & | high, | ||
| const int & | device = Device.cpu, |
||
| const unsigned int & | seed = __static_random_device(), |
||
| const unsigned int & | dtype = Type.Double |
||
| ) |
create an Tensor with all the elements are initialized with uniform distribution
| [in] | Nelem | the number of elements |
| [in] | low | the lower-bound of range |
| [in] | high | the upper-bound of range |
| [in] | device | the device that the Tensor is put on. It can be any device defined in cytnx::Device |
| [in] | seed | the seed for the random generator. [Default] using device entropy |
| [in] | dtype | the data type of the Tensor. [Default] cytnx::Type.Double |
| void cytnx::random::uniform_ | ( | cytnx::Storage & | Sin, |
| const double & | low = 0, |
||
| const double & | high = 1, |
||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a Storage with uniform distributon.
| [in] | Sin | a Storage |
| [in] | low | the lower-bound of the uniform distribution |
| [in] | high | the higher-bound of the uniform distribution |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
| void cytnx::random::uniform_ | ( | cytnx::Tensor & | Tin, |
| const double & | low = 0, |
||
| const double & | high = 1, |
||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a Tensor with uniform distributon.
| [in] | Tin | a Tensor |
| [in] | low | the lower-bound of the uniform distribution |
| [in] | high | the higher-bound of the uniform distribution |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
| void cytnx::random::uniform_ | ( | cytnx::UniTensor & | Tin, |
| const double & | low = 0, |
||
| const double & | high = 1, |
||
| const unsigned int & | seed = __static_random_device() |
||
| ) |
Randomize the memory of a UniTensor with uniform distributon.
| [in] | Tin | a UniTensor |
| [in] | low | the lower-bound of the uniform distribution |
| [in] | high | the higher-bound of the uniform distribution |
| [in] | seed | the seed for the random generator. [Default] Using device entropy. |
|
extern |