18#ifndef __NNFW_CKER_STATELESS_RANDOM_UNIFORM_H__
19#define __NNFW_CKER_STATELESS_RANDOM_UNIFORM_H__
44 const auto seed_vals = seed.
flat<int32_t>();
50 (*out_key)[0] = 0x3ec8f720;
51 (*out_key)[1] = 0x02461e29;
52 (*out_counter)[0] =
static_cast<uint32_t
>(seed0);
53 (*out_counter)[1] = (*out_counter)[3] = 0;
54 (*out_counter)[2] =
static_cast<uint32_t
>(seed1);
56 (*out_key)[0] = mix[0];
57 (*out_key)[1] = mix[1];
58 (*out_counter)[0] = (*out_counter)[1] = 0;
59 (*out_counter)[2] = mix[2];
60 (*out_counter)[3] = mix[3];
63template <
typename Device,
class Distribution>
67 typedef typename Distribution::ResultElementType T;
69 auto flat = output->flat<T>();
76 const Shape &seed_shape,
const int32_t *seed_data,
83 shape_t.
buffer = (
void *)shape_data;
86 seed_t.
buffer = (
void *)seed_data;
90 output_t.
buffer = output_data;
97 Fill<Eigen::ThreadPoolDevice, random::UniformDistribution<random::PhiloxRandom, float>>(
int32_t DimensionsCount() const
void ReplaceWith(int dimensions_count, const int32_t *dims_data)
const luci_interpreter::RuntimeShape output_shape
void StatelessRandomUniform(const Shape &shape_shape, const int32_t *shape_data, const Shape &seed_shape, const int32_t *seed_data, const Shape &output_shape, float *output_data)
void GenerateKey(Tensor seed, random::PhiloxRandom::Key *out_key, random::PhiloxRandom::ResultType *out_counter)
void Fill(const T *value_data, const Shape &output_shape, T *output_data)