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
634f5844
Commit
634f5844
authored
Jul 27, 2023
by
Brian Pickrell
Browse files
clean up merge bugs
parent
6fc3f195
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
24 deletions
+15
-24
src/include/migraphx/op/rand_uniform.hpp
src/include/migraphx/op/rand_uniform.hpp
+14
-23
test/ref_ops_test.cpp
test/ref_ops_test.cpp
+1
-1
No files found.
src/include/migraphx/op/rand_uniform.hpp
View file @
634f5844
...
...
@@ -46,7 +46,7 @@ namespace op {
struct
rand_uniform
{
uint32_t
sample_size
=
{
2
3
};
uint32_t
sample_size
=
{
2
0
};
uint32_t
seed
=
{
0
};
shape
::
type_t
dtype
=
shape
::
type_t
::
float_type
;
...
...
@@ -62,32 +62,23 @@ struct rand_uniform
std
::
string
name
()
const
{
return
"rand_uniform"
;
}
shape
normalize_compute_shape
(
std
::
vector
<
shape
>
inputs
)
const
{
if
(
inputs
.
size
()
>
0
)
check_shapes
{
inputs
,
*
this
,
true
}.
has
(
1
);
auto
s
=
inputs
.
front
();
if
(
s
.
dynamic
())
{
check_shapes
{
inputs
,
*
this
,
true
}.
has
(
1
);
auto
s
=
inputs
.
front
();
if
(
s
.
dynamic
())
{
// return s;
return
{
dtype
,
{
s
.
dyn_dims
()[
0
],
{
sample_size
,
sample_size
}}};
}
else
if
(
s
.
broadcasted
())
{
return
{
s
.
type
(),
s
.
lens
()};
}
else
{
// For static input, return the input shape. Assume the batch_size and sample_size
// have already been factored in. This saves us from reallocating a shape at
// runtime when the input is a literal.
return
s
.
with_lens
(
s
.
lens
());
}
return
s
;
}
else
if
(
s
.
broadcasted
())
{
return
{
s
.
type
(),
s
.
lens
()};
}
else
{
return
s
.
with_lens
(
s
.
lens
());
}
// No input instruction is required. 1-dimensional static output.
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
argument
result
{
dyn_out
.
computed_shape
};
...
...
test/ref_ops_test.cpp
View file @
634f5844
...
...
@@ -5366,7 +5366,7 @@ TEST_CASE(multinomial_dyn_test)
std::transform(res_dist.begin(), res_dist.end(), res_norm.begin(), [&](auto n) {
return static_cast<double>(n) / res_dist_sum;
});
EXPECT(migraphx::verify::verify_range(norm, res_norm, 100000));
EXPECT(migraphx::verify::verify_range(norm, res_norm, 100000
0
));
}
TEST_CASE(neg_test)
...
...
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