Cytnx v0.9.6
Loading...
Searching...
No Matches
Namespaces | Functions
random.hpp File Reference
#include "Type.hpp"
#include "Device.hpp"
#include "cytnx_error.hpp"
#include <vector>
#include <initializer_list>
#include <random>
#include "Tensor.hpp"
#include "UniTensor.hpp"
#include "backend/Storage.hpp"
Include dependency graph for random.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  cytnx
 Helper function to print vector with ODT:
 
namespace  cytnx::random
 The randomization related functions.
 

Functions

void cytnx::random::normal_ (cytnx::Storage &Sin, const double &mean, const double &std, const unsigned int &seed=std::random_device()())
 Randomize the memory of a Storage with normal distributon.
 
void cytnx::random::uniform_ (cytnx::Storage &Sin, const double &low=0, const double &high=1, const unsigned int &seed=std::random_device()())
 Randomize the memory of a Storage with uniform distributon.
 
void cytnx::random::normal_ (cytnx::Tensor &Tin, const double &mean, const double &std, const unsigned int &seed=std::random_device()())
 Randomize the memory of a Tensor with normal distributon.
 
void cytnx::random::uniform_ (cytnx::Tensor &Tin, const double &low=0, const double &high=1, const unsigned int &seed=std::random_device()())
 Randomize the memory of a Tensor with uniform distributon.
 
void cytnx::random::normal_ (cytnx::UniTensor &Tin, const double &mean, const double &std, const unsigned int &seed=std::random_device()())
 Randomize the memory of a UniTensor with normal distributon.
 
void cytnx::random::uniform_ (cytnx::UniTensor &Tin, const double &low=0, const double &high=1, const unsigned int &seed=std::random_device()())
 Randomize the memory of a UniTensor with uniform distributon.
 
Tensor cytnx::random::normal (const cytnx_uint64 &Nelem, const double &mean, const double &std, const int &device=Device.cpu, const unsigned int &seed=std::random_device()(), const unsigned int &dtype=Type.Double)
 create an Tensor with all the elements are initialized with normal distribution
 
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=std::random_device()(), const unsigned int &dtype=Type.Double)
 create an Tensor with all the elements are initialized with normal distribution
 
Tensor cytnx::random::uniform (const cytnx_uint64 &Nelem, const double &low, const double &high, const int &device=Device.cpu, const unsigned int &seed=std::random_device()(), const unsigned int &dtype=Type.Double)
 create an Tensor with all the elements are initialized with uniform distribution
 
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=std::random_device()(), const unsigned int &dtype=Type.Double)
 create an Tensor with all the elements are initialized with uniform distribution