• 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_SRC_CXX_API_CONTEXT_H_
17 #define MINDSPORE_LITE_SRC_CXX_API_CONTEXT_H_
18 
19 #include <cstdint>
20 #include <map>
21 #include <vector>
22 #include <string>
23 #include <memory>
24 #ifndef SUPPORT_NNIE
25 #include <any>
26 #else
27 #include <experimental/any>
28 #endif
29 #include "include/api/context.h"
30 
31 namespace mindspore {
32 struct Context::Data {
33   std::vector<std::shared_ptr<DeviceInfoContext>> device_info_list;
34   int32_t thread_num = 2;
35   bool enable_parallel_ = false;
36   std::vector<int32_t> affinity_core_list_;
37   int affinity_mode_ = 0;
38   std::shared_ptr<Delegate> delegate = nullptr;
39 };
40 
41 struct DeviceInfoContext::Data {
42 #ifndef SUPPORT_NNIE
43   std::map<std::string, std::any> params;
44 #else
45   std::map<std::string, std::experimental::any> params;
46 #endif
47   std::shared_ptr<Allocator> allocator = nullptr;
48 };
49 }  // namespace mindspore
50 
51 #endif  // MINDSPORE_LITE_SRC_CXX_API_CONTEXT_H_
52