• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 Huawei Technologies Co., Ltd
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 #ifndef MINDSPORE_LITE_INCLUDE_TRAIN_TRAIN_SESSION_H_
17 #define MINDSPORE_LITE_INCLUDE_TRAIN_TRAIN_SESSION_H_
18 #include <string>
19 #include "include/lite_session.h"
20 
21 namespace mindspore {
22 namespace session {
23 class TrainSession {
24  public:
25   /// \brief Static method to create a TransferSession object
26   ///
27   /// \param[in] filename_backbone Filename to read backbone net flatbuffer from
28   /// \param[in] filename_head Filename to read head net flatbuffer from
29   /// \param[in] context Defines the context of the session to be created
30   /// \param[in] train_mode training mode to initialize Session with
31   ///
32   /// \return Pointer of MindSpore LiteSession
33   static LiteSession *CreateTransferSession(const std::string &filename_backbone, const std::string &filename_head,
34                                             const lite::Context *context, bool train_mode = false,
35                                             const lite::TrainCfg *cfg = nullptr);
36 
37   /// \brief Static method to create a TrainSession object
38   ///
39   /// \param[in] filename name of flatbuffer that holds the flatbuffer
40   /// \param[in] context Defines the context of the session to be created
41   /// \param[in] train_mode training mode to initialize Session with
42   /// \param[in] cfg training configuration, set to null for default configuration
43   ///
44   /// \return Pointer of MindSpore LiteSession
45   static LiteSession *CreateTrainSession(const std::string &filename, const lite::Context *context,
46                                          bool train_mode = false, const lite::TrainCfg *cfg = nullptr);
47 };
48 }  // namespace session
49 }  // namespace mindspore
50 #endif  // MINDSPORE_LITE_INCLUDE_TRAIN_TRAIN_SESSION_H_
51