ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Driver.cpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "H5Writer.h"
18
19#include <arser/arser.h>
20
21using namespace minmax_embedder_test;
22
23int entry(const int argc, char **argv)
24{
25 arser::Arser arser("Generate min/max data to test minmax-embedder");
26 arser.add_argument("--num_inputs")
27 .type(arser::DataType::INT32)
28 .default_value(1)
29 .help("number of input layers (default:1)");
30 arser.add_argument("--num_ops")
31 .type(arser::DataType::INT32)
32 .default_value(1)
33 .help("number of operators (default:1)");
34 arser.add_argument("minmax").help("path to generated minmax data");
35
36 try
37 {
38 arser.parse(argc, argv);
39 }
40 catch (const std::runtime_error &err)
41 {
42 std::cout << err.what() << std::endl;
43 std::cout << arser;
44 return 255;
45 }
46
47 auto num_inputs = arser.get<int>("--num_inputs");
48 auto num_ops = arser.get<int>("--num_ops");
49 auto data_output_path = arser.get<std::string>("minmax");
50
51 ModelSpec mspec;
52 {
53 if (num_inputs <= 0 || num_ops <= 0)
54 {
55 std::cout << "num_inputs and num_ops must be positive integers." << std::endl;
56 return 255;
57 }
58 mspec.n_inputs = num_inputs;
59 mspec.n_ops = num_ops;
60 }
61 H5Writer writer(mspec, data_output_path);
62 writer.dump();
63
64 return EXIT_SUCCESS;
65}
int entry(const int argc, char **argv)
Dump IR for given arguments.
Definition Driver.cpp:23
Definition arser.h:39