Commit db75de13 authored by Brian Pickrell's avatar Brian Pickrell
Browse files

Removed no-inputs case in parse_multinomial

parent e15e7ee3
...@@ -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])+ ...) )
......
...@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment