ATLAS Offline Software
extract-onnx-metadata.cxx
Go to the documentation of this file.
2 #include <iostream>
3 
4 int main(int narg, char* argv[]) {
5  std::cout<<narg;
6  if (narg != 3 && narg != 2) {
7  std::cout << "usage: " << argv[0] << " <onnx_file> [key]" << std::endl;
8  return 1;
9  }
10 
11  ONNXWrapper* model = new ONNXWrapper(argv[1]);
12 
13 
14  // no key provided, print out all
15  if (narg == 2) { // should be extend to more that 2 inputs and outputs
16  // print input/output shape and names
17  for ( const auto &p : model->GetModelInputs() )
18  {
19  std::string separator;
20  std::cout << "Input: " << p.first << ", shape: (";
21  for (auto x : p.second) {
22  std::cout << separator << x;
23  separator = ",";
24  }
25  std::cout << ")" << std::endl;
26  }
27  for ( const auto &p : model->GetModelOutputs() )
28  {
29  std::string separator;
30  std::cout << "Outputs: " << p.first << ", shape: (";
31  for (auto x : p.second) {
32  std::cout << separator << x;
33  separator = ",";
34  }
35  std::cout << ")" << std::endl;
36  }
37  for ( const auto &p : model->GetMETAData() )
38  {
39  std::cout <<"META data: "<< p.first << '\t' << p.second.at(0) << std::endl;
40  }
41  // print meta data
42  delete model;
43  return 2;
44  }
45 
46  // key provided, print out key
47  std::cout << model->GetMETADataByKey(argv[2]) << std::endl;
48  delete model;
49 
50  return 0;
51 }
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ONNXWrapper
Definition: ONNXWrapper.h:16
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
x
#define x
ONNXWrapper.h
correlationModel::model
model
Definition: AsgElectronEfficiencyCorrectionTool.cxx:46
main
int main(int narg, char *argv[])
Definition: extract-onnx-metadata.cxx:4