Line data Source code
1 : // SPDX-License-Identifier: Apache-2.0
2 : /**
3 : * Copyright (C) 2020 Parichay Kapoor <pk.kapoor@samsung.com>
4 : *
5 : * @file optimizer_devel.cpp
6 : * @date 08 April 2020
7 : * @brief This is Optimizer internal interface class
8 : * @see https://github.com/nnstreamer/nntrainer
9 : * @author Jijoong Moon <jijoong.moon@samsung.com>
10 : * @author Parichay Kapoor <pk.kapoor@samsung.com>
11 : * @bug No known bugs except for NYI items
12 : *
13 : */
14 :
15 : #include <fstream>
16 : #include <iostream>
17 :
18 : #include <nntrainer_error.h>
19 : #include <optimizer_devel.h>
20 : #include <util_func.h>
21 :
22 : namespace nntrainer {
23 :
24 1569 : void Optimizer::setProperty(const std::vector<std::string> &values) {
25 1569 : if (!values.empty()) {
26 : std::string msg = "[OptimizerDevel] Unknown properties count " +
27 7 : std::to_string(values.size());
28 14 : throw exception::not_supported(msg);
29 : }
30 1562 : }
31 :
32 0 : void Optimizer::read(std::ifstream &file) {
33 0 : std::string loaded_type = readString(file);
34 :
35 0 : if (loaded_type != getType()) {
36 : throw std::runtime_error(
37 0 : "[Optimizer::read] written type unmatches with set type");
38 : }
39 0 : }
40 :
41 0 : void Optimizer::save(std::ofstream &file) { writeString(file, getType()); }
42 :
43 : } // namespace nntrainer
|