Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
6fc3f195
Commit
6fc3f195
authored
Jul 27, 2023
by
Brian Pickrell
Browse files
work in progress
parent
de479d9a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
src/include/migraphx/op/rand_uniform.hpp
src/include/migraphx/op/rand_uniform.hpp
+9
-9
No files found.
src/include/migraphx/op/rand_uniform.hpp
View file @
6fc3f195
...
...
@@ -96,15 +96,15 @@ struct rand_uniform
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
size_t
elts
(
dyn_out
.
computed_shape
.
elements
());
// Use of our visitor and par_for replaces a call like
std
::
vector
<
float
>
rand_samples
(
sample_size
);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
//
std::vector<float> rand_samples(sample_size);
//
std::generate(rand_samples.begin(), rand_samples.end(), [&]() { return dis(gen); });
//
result.visit([&](auto output) {
//
par_for(elts, [&](auto i) {
//
output[i] = dis(gen);
//
// output[i] = rand_samples[i];
//
});
//
});
result
.
visit
([
&
](
auto
output
)
{
par_for
(
elts
,
[
&
](
auto
i
)
{
output
[
i
]
=
dis
(
gen
);
// output[i] = rand_samples[i];
});
});
return
result
;
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment