• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2 * Copyright 2022-2023 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_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_RESOURCE_INFO_H_
17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_RESOURCE_INFO_H_
18 
19 #include <memory>
20 #include <set>
21 #include <string>
22 #include <unordered_map>
23 #include <vector>
24 
25 // Description of data in device
26 struct RawData {
27   size_t lenOfByte;  // Size of memory, bytes
28   void *data;        // Pointer of data
29 };
30 
31 enum ModelLoadMethod {
32   LOAD_FROM_FILE = 0,       // Loading from file, memory of model and weights are managed by ACL
33   LOAD_FROM_MEM,            // Loading from memory, memory of model and weights are managed by ACL
34   LOAD_FROM_FILE_WITH_MEM,  // Loading from file, memory of model and weight are managed by user
35   LOAD_FROM_MEM_WITH_MEM    // Loading from memory, memory of model and weight are managed by user
36 };
37 
38 struct ModelInfo {
39   std::string modelName;
40   std::string modelPath;               // Path of om model file
41   size_t modelFileSize;                // Size of om model file
42   std::shared_ptr<void> modelFilePtr;  // Smart pointer of model file data
43   uint32_t modelWidth;                 // Input width of model
44   uint32_t modelHeight;                // Input height of model
45   ModelLoadMethod method;              // Loading method of model
46 };
47 
48 // Device resource info, such as model infos, etc
49 struct DeviceResInfo {
50   std::vector<ModelInfo> modelInfos;
51 };
52 
53 struct ResourceInfo {
54   std::set<int> deviceIds;
55   std::string singleOpFolderPath;
56   std::unordered_map<int, DeviceResInfo> deviceResInfos;  // map <deviceId, deviceResourceInfo>
57 };
58 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_UTILS_RESOURCE_INFO_H_
59