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
Hide 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
...
@@ -87,7 +87,7 @@ struct rand_uniform
...
@@ -87,7 +87,7 @@ struct rand_uniform
return
shape
{
dtype
,
{
sample_size
}};
return
shape
{
dtype
,
{
sample_size
}};
}
}
argument
compute
(
const
dyn_output
&
dyn_out
,
std
::
vector
<
argument
>
args
)
const
argument
compute
(
const
dyn_output
&
dyn_out
,
std
::
vector
<
argument
>
args
)
const
{
{
(
void
)
args
;
// suppress compiler warning
(
void
)
args
;
// suppress compiler warning
argument
result
{
dyn_out
.
computed_shape
};
argument
result
{
dyn_out
.
computed_shape
};
...
@@ -96,15 +96,15 @@ struct rand_uniform
...
@@ -96,15 +96,15 @@ struct rand_uniform
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
std
::
uniform_real_distribution
<>
dis
(
0.0
,
1.0
);
size_t
elts
(
dyn_out
.
computed_shape
.
elements
());
size_t
elts
(
dyn_out
.
computed_shape
.
elements
());
// Use of our visitor and par_for replaces a call like
// Use of our visitor and par_for replaces a call like
std
::
vector
<
float
>
rand_samples
(
sample_size
);
//
std::vector<float> rand_samples(sample_size);
std
::
generate
(
rand_samples
.
begin
(),
rand_samples
.
end
(),
[
&
]()
{
return
dis
(
gen
);
});
//
std::generate(rand_samples.begin(), rand_samples.end(), [&]() { return dis(gen); });
//
result.visit([&](auto output) {
result
.
visit
([
&
](
auto
output
)
{
//
par_for(elts, [&](auto i) {
par_for
(
elts
,
[
&
](
auto
i
)
{
//
output[i] = dis(gen);
output
[
i
]
=
dis
(
gen
);
//
// output[i] = rand_samples[i];
// output[i] = rand_samples[i];
//
});
});
//
});
});
return
result
;
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