Commit 390bb853 authored by Ted Themistokleous's avatar Ted Themistokleous
Browse files

Imply type of literal returned based on input protobuff for zero element constant values.

This saves us the default behavior as the onnx parsing assumes that every zero value is float. This way we're still grabbing relevant type information from the protobuff instead and wont fail our data type checks for if them/else blocks from onnx
parent ebdddf58
......@@ -39,11 +39,13 @@ struct parse_constant : op_parser<parse_constant>
onnx_parser::node_info info,
const std::vector<instruction_ref>& /*args*/) const
{
literal v = parser.parse_value(info.attributes.at("value"));
// return empty literal
if(v.get_shape().elements() == 0)
{
return info.add_literal(literal{});
auto dim_param = info.attributes.at("value").t().dims();
return info.add_literal(literal{dim_param.at(0)});
}
auto dim_size = info.attributes.at("value").t().dims_size();
......
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