14 if (nodeproto.op_type() ==
"Flatten")
16 else if (nodeproto.op_type() ==
"Squeeze")
18 else if (nodeproto.op_type() ==
"Unsqueeze")
23 auto input_name = nodeproto.input(0);
25 auto input2_name = ((nodeproto.input_size() > 1) && ( opMode ==
Reshape || opMode ==
Unsqueeze || opMode ==
Squeeze) )
26 ? nodeproto.input(1) :
"";
30 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser Reshape op has input tensor" + input_name +
31 " but its type is not yet registered");
37 std::unique_ptr<ROperator> op;
38 int attr_value = (opMode ==
Reshape) ? 0 : 1;
39 if ((opMode ==
Reshape || opMode ==
Flatten) && nodeproto.attribute_size() > 0)
40 attr_value = nodeproto.attribute(0).i();
42 std::vector<int64_t> attr_axes = {};
44 if (nodeproto.input_size() == 1 && nodeproto.attribute_size() > 0 && (opMode ==
Squeeze || opMode ==
Unsqueeze)) {
45 std::string attribute_name = nodeproto.attribute(0).name();
46 if (attribute_name ==
"axes")
47 attr_axes = {nodeproto.attribute(0).ints().begin(), nodeproto.attribute(0).ints().end()};
50 std::string output_name = nodeproto.output(0);
52 if (attr_axes.empty())
54 op.reset(
new ROperator_Reshape(opMode, attr_value, input_name, input2_name, output_name));