20 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser ConstantOfShape op has input tensor" +
input_name +
21 " but its type is not yet registered");
26 std::cout <<
"\t.... ";
28 std::cout <<
"ConstantOfShape " <<
nodeproto.input(0) <<
" -> ";
30 std::cout <<
"Constant --> ";
31 std::cout <<
nodeproto.output(0) << std::endl;
34 std::unique_ptr<ROperator>
op;
39 std::vector<std::size_t> shape;
42 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser Constant or ConstantOfShape and attribute size is larger than 1");
52 shape.push_back(t.
dims(
j));
58 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser ConstantOfShape has invalid tensor size " + std::to_string(
length));
64 std::vector<int32_t> values(
length);
66 for (
size_t i = 0; i <
length; i++)
76 std::vector<int64_t> values(
length);
78 for (
size_t i = 0; i <
length; i++)
88 std::vector<float> values(
length);
90 for (
size_t i = 0; i <
length; i++)
100 std::vector<double> values(
length);
102 for (
size_t i = 0; i <
length; i++)
113 std::vector<int8_t> values(
length);
115 for (
size_t i = 0; i <
length; i++) {
118 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser Constant has invalid boolean value " + std::to_string(val));
119 values[i] =
static_cast<int8_t
>(val);
122 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser COnstant : invalid tensor data values");
129 " is not supported!\n");
137 std::vector<float> values(1);
143 auto values = std::vector<float>({
nodeproto.attribute(0).floats().begin(),
nodeproto.attribute(0).floats().
end()});
144 shape.push_back(values.size());
148 std::vector<int64_t> values(1);
154 auto values = std::vector<int64_t>({
nodeproto.attribute(0).ints().begin(),
nodeproto.attribute(0).ints().
end()});
155 shape.push_back(values.size());
158 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser Constant op: not yet supporting attribute " +
attribute_name);
161 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser ConstantOfShape op: parsed invalid attribute " +
attribute_name);
169 std::vector<float> values(1);
173 throw std::runtime_error(
"TMVA::SOFIE ONNX Parser Constant has no attribute");
182 std::cout <<
"\t ParseConstant: operator created\n";