#include <rand.h>
|
static void | setSeed (int64_t seed) |
| Set the seed for random generators: this one, rand(3) and ATen. More...
|
|
static void | setLocalSeed (int64_t seed) |
| Set a static seed for the local thread. More...
|
|
static uint64_t | rand () |
| Sample random value. More...
|
|
static int64_t | defaultRandomSeed () |
| Default random seed used by init() More...
|
|
template<typename T > |
static T | makeRandEngine () |
| Random number engine based on previously set seed. More...
|
|
template<typename T > |
static auto | sample (T &&distrib) -> decltype(distrib.min()) |
| Sample from a given distribution. More...
|
|
static at::Generator * | gen () |
| This allows to use a custom seed in torch. More...
|
|
int64_t common::Rand::defaultRandomSeed |
( |
| ) |
|
|
static |
Default random seed used by init()
at::Generator * common::Rand::gen |
( |
| ) |
|
|
static |
This allows to use a custom seed in torch.
For example: at::normal(mean, dev, Rand::gen()); Similarly to rand(), this will use a thread_local generator if a local seed is set
template<typename T >
static T common::Rand::makeRandEngine |
( |
| ) |
|
|
inlinestatic |
Random number engine based on previously set seed.
uint64_t common::Rand::rand |
( |
| ) |
|
|
static |
template<typename T >
static auto common::Rand::sample |
( |
T && |
distrib | ) |
-> decltype(distrib.min()) |
|
inlinestatic |
Sample from a given distribution.
void common::Rand::setLocalSeed |
( |
int64_t |
seed | ) |
|
|
static |
Set a static seed for the local thread.
void common::Rand::setSeed |
( |
int64_t |
seed | ) |
|
|
static |
Set the seed for random generators: this one, rand(3) and ATen.
thread_local bool common::Rand::hasLocalSeed_ = false |
|
staticprotected |
thread_local std::mt19937 common::Rand::localRandEngine_ |
|
staticprotected |
thread_local std::unique_ptr< at::Generator > common::Rand::localTorchEngine_ |
|
staticprotected |
std::mt19937 common::Rand::randEngine_ |
|
staticprotected |
std::mutex common::Rand::randEngineMutex_ |
|
staticprotected |
std::unique_ptr< at::Generator > common::Rand::torchEngine_ |
|
staticprotected |
The documentation for this class was generated from the following files: