Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / runtime / onert / core / include / compiler / train / TrainingInfo.h
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 #ifndef __ONERT_COMPILER_TRAIN_TRAINING_INFO_H__
18 #define __ONERT_COMPILER_TRAIN_TRAINING_INFO_H__
19
20 #include "ir/Index.h"
21 #include "exec/train/optimizer/OptimizerCode.h"
22 #include "ir/operation/Loss.h"
23
24 namespace onert
25 {
26 namespace compiler
27 {
28 namespace train
29 {
30
31 struct LossInfo
32 {
33   ir::operation::Loss::Type type;
34   // TODO Add members for loss
35 };
36
37 struct OptimizerInfo
38 {
39   exec::train::optimizer::OptimizerCode optim_code;
40   float learning_rate;
41   // TODO Add properties
42 };
43
44 class TrainingInfo
45 {
46 public:
47   TrainingInfo() {}
48   TrainingInfo(const TrainingInfo &obj) = default;
49   TrainingInfo(TrainingInfo &&) = default;
50   TrainingInfo &operator=(const TrainingInfo &) = default;
51   TrainingInfo &operator=(TrainingInfo &&) = default;
52   ~TrainingInfo() = default;
53
54   uint32_t batchSize() const { return _batch_size; }
55   void setBatchSize(const uint32_t batch_size) { _batch_size = batch_size; }
56   const LossInfo &lossInfo() const { return _loss_info; }
57   void setLossInfo(const LossInfo &loss_info) { _loss_info = loss_info; }
58   const OptimizerInfo &optimizerInfo() const { return _optimizer_info; }
59   void setOptimizerInfo(const OptimizerInfo &optimizer_info) { _optimizer_info = optimizer_info; }
60
61 private:
62   LossInfo _loss_info;
63   OptimizerInfo _optimizer_info;
64   uint32_t _batch_size;
65 };
66
67 } // namespace train
68 } // namespace compiler
69 } // namespace onert
70
71 #endif // __ONERT_COMPILER_TRAIN_TRAINING_INFO_H__