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
db75de13
Commit
db75de13
authored
Sep 06, 2023
by
Brian Pickrell
Browse files
Removed no-inputs case in parse_multinomial
parent
e15e7ee3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
+15
-9
src/include/migraphx/op/multinomial.hpp
src/include/migraphx/op/multinomial.hpp
+1
-1
src/onnx/parse_multinomial.cpp
src/onnx/parse_multinomial.cpp
+14
-8
No files found.
src/include/migraphx/op/multinomial.hpp
View file @
db75de13
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
*
*
* In the large number limit, the fractional counts approach the multinomial distribution.
* In the large number limit, the fractional counts approach the multinomial distribution.
*
*
* Inputs: args[0] - a vector of probabilities for each category. Values are running
* Inputs: args[0] - a vector of probabilities for each category. Values are running
* totals as provided by op prefix_scan_sum.
* totals as provided by op prefix_scan_sum.
* Values are log normalized (i.e. start with any set of numbers > 0, then
* Values are log normalized (i.e. start with any set of numbers > 0, then
* val[i] = log(val[i]) / sum (log(val[0]) + log(val[1])+ ...) )
* val[i] = log(val[i]) / sum (log(val[0]) + log(val[1])+ ...) )
...
...
src/onnx/parse_multinomial.cpp
View file @
db75de13
...
@@ -102,14 +102,20 @@ struct parse_multinomial : op_parser<parse_multinomial>
...
@@ -102,14 +102,20 @@ struct parse_multinomial : op_parser<parse_multinomial>
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
rand_dummy
);
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
rand_dummy
);
}
}
}
}
else
{
// TODO: Confirm that this case with no inputs should not be supported. The input defines
// use literal. It may be quite large.
// the number of categories, which can't be defaulted. You can't get to this line with no
auto
rand_dummy
=
info
.
add_literal
(
// inputs because there will be an exception when accessing args[0] above.
migraphx
::
literal
{
migraphx
::
shape
::
float_type
,
{
batch_size
*
sample_size
}});
randoms
=
// else
info
.
add_instruction
(
migraphx
::
make_op
(
"random_uniform"
),
seed_input
,
rand_dummy
);
// {
}
// // use literal. It may be quite large.
// auto rand_dummy = info.add_literal(
// migraphx::literal{migraphx::shape::float_type, {batch_size * sample_size}});
// randoms =
// info.add_instruction(migraphx::make_op("random_uniform"), seed_input,
// rand_dummy);
// }
return
info
.
add_instruction
(
return
info
.
add_instruction
(
migraphx
::
make_op
(
"multinomial"
,
{{
"dtype"
,
output_type
}}),
cdf
,
randoms
);
migraphx
::
make_op
(
"multinomial"
,
{{
"dtype"
,
output_type
}}),
cdf
,
randoms
);
...
...
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