MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Run

Method Run

tensorflow/core/kernels/random_op_gpu.h:133–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131// distribution. Each output takes a fixed number of samples.
132template <class Distribution>
133PHILOX_DEVICE_INLINE void FillPhiloxRandomKernel<Distribution, false>::Run(
134 random::PhiloxRandom gen, T* data, int64 size, Distribution dist) {
135 const int kGroupSize = Distribution::kResultElementCount;
136
137 const int32 thread_id = blockIdx.x * blockDim.x + threadIdx.x;
138 const int32 total_thread_count = gridDim.x * blockDim.x;
139 int64 offset = thread_id * kGroupSize;
140 gen.Skip(thread_id);
141
142 const SampleCopier<T, kGroupSize> copier;
143 while (offset + kGroupSize <= size) {
144 const typename Distribution::ResultType samples = dist(&gen);
145 copier(&data[offset], samples);
146
147 offset += total_thread_count * kGroupSize;
148 gen.Skip(total_thread_count - 1);
149 }
150
151 typename Distribution::ResultType samples = dist(&gen);
152 for (int i = 0; i < kGroupSize; ++i) {
153 if (offset >= size) {
154 return;
155 }
156 data[offset] = samples[i];
157 ++offset;
158 }
159}
160
161// A cuda kernel to fill the data with random numbers from the specified
162// distribution. Each output takes a variable number of samples.

Callers 15

PackGradFunction · 0.45
UnpackGradFunction · 0.45
ConcatGradFunction · 0.45
ConcatGradV2Function · 0.45
SplitGradFunction · 0.45
SplitVGradFunction · 0.45
ReshapeGradFunction · 0.45
ExpandDimsGradFunction · 0.45
SqueezeGradFunction · 0.45
TransposeGradFunction · 0.45
ReverseGradFunction · 0.45

Calls 1

SkipMethod · 0.45

Tested by 15

PackGradFunction · 0.36
UnpackGradFunction · 0.36
ConcatGradFunction · 0.36
ConcatGradV2Function · 0.36
SplitGradFunction · 0.36
SplitVGradFunction · 0.36
ReshapeGradFunction · 0.36
ExpandDimsGradFunction · 0.36
SqueezeGradFunction · 0.36
TransposeGradFunction · 0.36
ReverseGradFunction · 0.36
ReverseV2GradFunction · 0.36