Commit 40595b78 authored by Paul's avatar Paul
Browse files

Fix parsing ints

parent 21e88916
...@@ -227,6 +227,13 @@ struct onnx_parser ...@@ -227,6 +227,13 @@ struct onnx_parser
return result; return result;
} }
template<class T>
static rtg::literal from_repeated(rtg::shape::type_t t, const T& r)
{
std::size_t size = r.size();
return rtg::literal{{t, {size}}, r.begin(), r.end()};
}
static rtg::literal parse_value(const onnx::AttributeProto& attr) static rtg::literal parse_value(const onnx::AttributeProto& attr)
{ {
switch(attr.type()) switch(attr.type())
...@@ -237,11 +244,8 @@ struct onnx_parser ...@@ -237,11 +244,8 @@ struct onnx_parser
case onnx::AttributeProto::STRING: return {}; case onnx::AttributeProto::STRING: return {};
case onnx::AttributeProto::TENSOR: return parse_tensor(attr.t()); case onnx::AttributeProto::TENSOR: return parse_tensor(attr.t());
case onnx::AttributeProto::GRAPH: return {}; case onnx::AttributeProto::GRAPH: return {};
case onnx::AttributeProto::FLOATS: case onnx::AttributeProto::FLOATS: return from_repeated(rtg::shape::float_type, attr.floats());
return rtg::literal{rtg::shape::float_type, attr.floats().begin(), attr.floats().end()}; case onnx::AttributeProto::INTS: return from_repeated(rtg::shape::int64_type, attr.ints());
case onnx::AttributeProto::INTS:
return rtg::literal{rtg::shape::int32_type, attr.ints().begin(), attr.ints().end()};
;
case onnx::AttributeProto::STRINGS: return {}; case onnx::AttributeProto::STRINGS: return {};
case onnx::AttributeProto::TENSORS: return {}; case onnx::AttributeProto::TENSORS: return {};
case onnx::AttributeProto::GRAPHS: return {}; case onnx::AttributeProto::GRAPHS: return {};
......
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