76     Element value_ = Element(0)
    77   ): view(view_), value(value_) { }
    80     view.at(coord) = 
value;
    94   Element val = Element(0)) {               
   109 template <
typename Element>
   127     seed(seed_), mean(mean_), stddev(stddev_), int_scale(int_scale_), pi(
std::acos(-1)) {
   128       std::srand((
unsigned)seed);
   135     double u1 = double(std::rand()) / double(RAND_MAX);
   136     double u2 = double(std::rand()) / double(RAND_MAX);
   140     rnd = mean + stddev * rnd;
   145     if (int_scale >= 0) {
   146       rnd = double(int64_t(rnd * 
double(1 << int_scale))) / double(1 << int_scale);
   147       result = 
static_cast<Element
>(rnd);
   150       result = 
static_cast<Element
>(rnd);
   158 template <
typename Element>
   176     seed(seed_), mean(mean_), stddev(stddev_), int_scale(int_scale_), pi(
std::acos(-1)) {
   177       std::srand((
unsigned)seed);
   185     for (
int i = 0; i < 2; ++i) {
   187       double u1 = double(std::rand()) / double(RAND_MAX);
   188       double u2 = double(std::rand()) / double(RAND_MAX);
   192       rnd = mean + stddev * rnd;
   194       if (int_scale >= 0) {
   195         rnd = double(
int(rnd * 
double(1 << int_scale)));
   196         reals[i] = from_real<Element>(rnd / double(1 << int_scale));
   199         reals[i] = from_real<Element>(rnd);
   231     view(view_), func(func_) {
   237     view.
at(coord) = func();
   290   for (
size_t i = 0; i < capacity; ++i) {
   291     ptr[i] = random_func();
   300 template <
typename Element>
   320     seed(seed_), range(
max - min_), min(min_), int_scale(int_scale_) {
   321       std::srand((
unsigned)seed);
   328     double rnd = double(std::rand()) / double(RAND_MAX);
   330     rnd = min + range * rnd;
   336     if (int_scale >= 0) {
   337       rnd = double(int64_t(rnd * 
double(1 << int_scale))) / double(1 << int_scale);
   338       result = 
static_cast<Element
>(
Real(rnd));
   341       result = 
static_cast<Element
>(
Real(rnd));
   349 template <
typename Element>
   369     seed(seed_), range(
max - min_), min(min_), int_scale(int_scale_) {
   370       std::srand((
unsigned)seed);
   379     for (
int i = 0; i < 2; ++i) {
   380       double rnd = double(std::rand()) / double(RAND_MAX);
   382       rnd = min + range * rnd;
   387       if (int_scale >= 0) {
   388         rnd = double(
int(rnd * 
double(1 << int_scale)));
   389         reals[i] = from_real<Element>(
Real(rnd / 
double(1 << int_scale)));
   392         reals[i] = from_real<Element>(
Real(rnd));
   396     return complex<Element>(reals[0], reals[1]);
   424     view(view_), func(func_) {
   431     view.
at(coord) = func();
   481   for (
size_t i = 0; i < capacity; ++i) {
   482     ptr[i] = random_func();
   512     Element diag_ = Element(1),
   513     Element other_ = Element(0)
   515     view(view_), diag(diag_), other(other_) { }
   521     for (
int i = 1; i < Layout::kRank; ++i) {
   522       if (coord[i] != coord[i - 1]) {
   528     view.
at(coord) = (is_diag ? diag : other);
   542   Element diag = Element(1),              
   543   Element other = Element(0)) {           
   579   Element val = Element(1)) {
   581   typename Layout::Index extent = dst.
extent().min();
   583   for (
typename Layout::Index i = 0; i < extent; ++i) {
   614     Element other_ = Element(0)
   616     view(view_), other(other_) { }
   622     for (
int i = 1; i < Layout::kRank; ++i) {
   623       if (coord[i] != coord[i - 1]) {
   630       view.
at(coord) = other;
   645   Element other = Element(1)) {
   676   Array<Element, Layout::kRank> 
v;
   688     Array<Element, Layout::kRank> 
const & v_,
   689     Element s_ = Element(0)
   691     view(view_), v(v_), s(s_) { }
   699     for (
int i = 0; i < Layout::kRank; ++i) {
   700       sum += Element(coord[i]) * v[i];
   703     view.
at(coord) = sum;
   717   Array<Element, Layout::kRank> 
const & v,
   718   Element s = Element(0)) {
   740   Element s = Element(0)) {
   742   Array<Element, Layout::kRank> stride;
   744   stride[0] = Element(1);
   747   for (
int i = 1; i < Layout::kRank; ++i) {
   748     stride[i] = stride[i - 1] * Element(dst.
extent()[i - 1]);
   764   Element v = Element(1),
   765   Element s = Element(0)) {
   768   while (i < capacity) {
   770                                         8)>::
get(ptr, i) = s;
   791     BlockFillRandomGaussian<Element>(
   800     BlockFillRandomUniform<Element>(
   819   Element 
const *ptr) {                     
   821   typename Layout::Index extent = dst.
extent().min();
   823   for (
typename Layout::Index i = 0; i < extent; ++i) {
   825     dst.
at(coord) = ptr[i];
   840   typename Layout::Index extent = src.
extent().min();
   842   for (
typename Layout::Index i = 0; i < extent; ++i) {
   844     ptr[i] = src.
at(coord);
 uint64_t seed
Definition: host/tensor_fill.h:112
CUTLASS_HOST_DEVICE complex< T > cos(complex< T > const &z)
Computes the cosine of complex z. 
Definition: complex.h:401
void TensorCopyDiagonalOut(Element *ptr, TensorView< Element, Layout > src)
Copies the diagonal of a tensor into a dense buffer in host memory. 
Definition: host/tensor_fill.h:836
Definition: aligned_buffer.h:35
Definition: distribution.h:40
< Layout function 
Definition: host/tensor_fill.h:494
Definition: distribution.h:40
struct cutlass::Distribution::@18::@20 uniform
Uniform distribution. 
TensorView< Element, Layout > TensorView
Definition: host/tensor_fill.h:61
void operator()(Coord< Layout::kRank > const &coord) const 
Definition: host/tensor_fill.h:517
Element diag
Definition: host/tensor_fill.h:503
Element operator()() const 
Compute random value and update RNG state. 
Definition: host/tensor_fill.h:132
T Type
Definition: real.h:32
Kind kind
Active variant kind. 
Definition: distribution.h:64
void TensorFill(TensorView< Element, Layout > dst, Element val=Element(0))
Fills a tensor with a uniform value. 
Definition: host/tensor_fill.h:92
CUTLASS_HOST_DEVICE TensorCoord const & extent() const 
Returns the extent of the view (the size along each logical dimension). 
Definition: tensor_view.h:167
RandomGaussianFunc(uint64_t seed_=0, double mean_=0, double stddev_=1, int int_scale_=-1)
Definition: host/tensor_fill.h:170
struct cutlass::Distribution::@18::@21 gaussian
Gaussian distribution. 
int int_scale
Definition: host/tensor_fill.h:164
void operator()(Coord< Layout::kRank > const &coord) const 
Definition: host/tensor_fill.h:79
TensorView view
Definition: host/tensor_fill.h:605
void TensorFillDiagonal(TensorView< Element, Layout > dst, Element diag=Element(1), Element other=Element(0))
Fills a tensor everywhere with a unique value for its diagonal. 
Definition: host/tensor_fill.h:540
< Layout function 
Definition: host/tensor_fill.h:667
int int_scale
Definition: host/tensor_fill.h:115
< Layout function 
Definition: host/tensor_fill.h:597
void TensorFillIdentity(TensorView< Element, Layout > dst)
Helper to fill a tensor's digonal with 1 and 0 everywhere else. 
Definition: host/tensor_fill.h:564
CUTLASS_HOST_DEVICE complex< T > log(complex< T > const &z)
Computes the complex exponential of z. 
Definition: complex.h:381
void operator()(Coord< Layout::kRank > const &coord) const 
Compute random value and update RNG state. 
Definition: host/tensor_fill.h:236
Statically sized array of elements that accommodates all CUTLASS-supported numeric types and is safe ...
#define CUTLASS_PRAGMA_UNROLL
Definition: cutlass.h:110
double mean
Definition: host/tensor_fill.h:113
void TensorUpdateOffDiagonal(TensorView< Element, Layout > dst, Element other=Element(1))
Writes a uniform value to all elements in the tensor without modifying diagonal elements. 
Definition: host/tensor_fill.h:643
Element s
Definition: host/tensor_fill.h:677
Array< Element, Layout::kRank > v
Definition: host/tensor_fill.h:676
TensorView view
Definition: host/tensor_fill.h:219
void TensorFillRandomGaussian(TensorView< Element, Layout > dst, uint64_t seed, double mean=0, double stddev=1, int bits=-1)
Fills a tensor with random values with a Gaussian distribution. 
Definition: host/tensor_fill.h:249
double stddev
Definition: host/tensor_fill.h:163
complex< Element > operator()() const 
Compute random value and update RNG state. 
Definition: host/tensor_fill.h:181
void TensorFillLinear(TensorView< Element, Layout > dst, Array< Element, Layout::kRank > const &v, Element s=Element(0))
Fills tensor with a linear combination of its coordinate and another vector. 
Definition: host/tensor_fill.h:715
Computes a random Gaussian distribution. 
Definition: host/tensor_fill.h:211
void TensorUpdateDiagonal(TensorView< Element, Layout > dst, Element val=Element(1))
Writes a uniform value to the diagonal of a tensor without modifying off-diagonal elements...
Definition: host/tensor_fill.h:577
Definition: subbyte_reference.h:557
void operator()(Coord< Layout::kRank > const &coord) const 
Updates the tensor. 
Definition: host/tensor_fill.h:694
void BlockFillRandomGaussian(Element *ptr, size_t capacity, uint64_t seed, double mean=0, double stddev=1, int bits=-1)
Fills a tensor with random values with a Gaussian distribution. 
Definition: host/tensor_fill.h:277
This header contains a class to parametrize a statistical distribution function. 
TensorView view
Definition: host/tensor_fill.h:502
Element value
Definition: host/tensor_fill.h:68
Top-level include for all CUTLASS numeric types. 
TensorFillLinearFunc(TensorView const &view_, Array< Element, Layout::kRank > const &v_, Element s_=Element(0))
Constructs functor. 
Definition: host/tensor_fill.h:686
double pi
Definition: host/tensor_fill.h:116
void operator()(Coord< Layout::kRank > const &coord) const 
Definition: host/tensor_fill.h:618
void BlockFillSequential(Element *ptr, int64_t capacity, Element v=Element(1), Element s=Element(0))
Fills a block of data with sequential elements. 
Definition: host/tensor_fill.h:761
double stddev
Definition: host/tensor_fill.h:114
double pi
Definition: host/tensor_fill.h:165
TensorUpdateOffDiagonalFunc(TensorView const &view_=TensorView(), Element other_=Element(0))
Definition: host/tensor_fill.h:612
Definition: host/tensor_fill.h:110
uint64_t seed
Definition: host/tensor_fill.h:161
TensorFillGaussianFunc(TensorView view_=TensorView(), RandomGaussianFunc< Element > func_=RandomGaussianFunc< Element >())
Construction of Gaussian RNG functor. 
Definition: host/tensor_fill.h:227
Element other
Definition: host/tensor_fill.h:606
TensorFillDiagonalFunc(TensorView const &view_=TensorView(), Element diag_=Element(1), Element other_=Element(0))
Definition: host/tensor_fill.h:510
RandomGaussianFunc(uint64_t seed_=0, double mean_=0, double stddev_=1, int int_scale_=-1)
Definition: host/tensor_fill.h:121
TensorView view
Definition: host/tensor_fill.h:67
CUTLASS_HOST_DEVICE Reference at(TensorCoord const &coord) const 
Returns a reference to the element at a given Coord. 
Definition: tensor_ref.h:307
TensorFillLinearFunc()
Definition: host/tensor_fill.h:683
void BlockFillRandomUniform(Element *ptr, size_t capacity, uint64_t seed, double max=1, double min=0, int bits=-1)
Fills a tensor with random values with a uniform random distribution. 
Definition: host/tensor_fill.h:470
void TensorForEach(Coord< Rank > extent, Func &func)
Iterates over the index space of a tensor. 
Definition: host/tensor_foreach.h:87
void TensorFillRandomUniform(TensorView< Element, Layout > dst, uint64_t seed, double max=1, double min=0, int bits=-1)
Fills a tensor with random values with a uniform random distribution. 
Definition: host/tensor_fill.h:443
void TensorCopyDiagonalIn(TensorView< Element, Layout > dst, Element const *ptr)
Copies a diagonal in from host memory without modifying off-diagonal elements. 
Definition: host/tensor_fill.h:817
Distribution type. 
Definition: distribution.h:38
RandomGaussianFunc< Element > func
Definition: host/tensor_fill.h:220
void TensorFillSequential(TensorView< Element, Layout > dst, Element s=Element(0))
Fills tensor with a linear combination of its coordinate and another vector. 
Definition: host/tensor_fill.h:738
< Layout function 
Definition: host/tensor_fill.h:59
int int_scale
Random values are cast to integer after scaling by this power of two. 
Definition: distribution.h:67
TensorFillFunc(TensorView const &view_=TensorView(), Element value_=Element(0))
Definition: host/tensor_fill.h:74
Basic include for CUTLASS. 
double mean
Definition: host/tensor_fill.h:162
TensorView view
Definition: host/tensor_fill.h:675
CUTLASS_HOST_DEVICE complex< T > sqrt(complex< T > const &z)
Computes the square root of complex number z. 
Definition: complex.h:393
Element other
Definition: host/tensor_fill.h:504
void BlockFillRandom(Element *ptr, size_t capacity, uint64_t seed, Distribution dist)
Fills a block of data with sequential elements. 
Definition: host/tensor_fill.h:784