|
|
|
@@ -19,6 +19,7 @@ |
|
|
|
#include <gtest/gtest.h> |
|
|
|
|
|
|
|
#include "proto/onnx/ge_onnx.pb.h" |
|
|
|
#include "parser/common/convert/pb2json.h" |
|
|
|
|
|
|
|
namespace ge { |
|
|
|
class UtestMessage2Operator : public testing::Test { |
|
|
|
@@ -55,4 +56,17 @@ TEST_F(UtestMessage2Operator, message_to_operator_fail) { |
|
|
|
ret = Message2Operator::ParseOperatorAttrs(attribute, 1, op_src); |
|
|
|
EXPECT_EQ(ret, FAILED); |
|
|
|
} |
|
|
|
|
|
|
|
TEST_F(UtestMessage2Operator, pb2json_one_field_json) { |
|
|
|
ge::onnx::NodeProto input_node; |
|
|
|
ge::onnx::AttributeProto *attribute = input_node.add_attribute(); |
|
|
|
attribute->set_name("attribute"); |
|
|
|
attribute->set_type(onnx::AttributeProto::AttributeType(1)); |
|
|
|
ge::onnx::TensorProto *attribute_tensor = attribute->mutable_t(); |
|
|
|
attribute_tensor->set_data_type(1); |
|
|
|
attribute_tensor->add_dims(4); |
|
|
|
attribute_tensor->set_raw_data("\007"); |
|
|
|
Json json; |
|
|
|
ge::Pb2Json::Message2Json(input_node, std::set<std::string>{}, json, true); |
|
|
|
} |
|
|
|
} // namespace ge |