FastDeploy  latest
Fast & Easy to Deploy!
option.h
1 // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include "fastdeploy/core/fd_type.h"
18 // https://github.com/PaddlePaddle/Paddle-Lite/issues/8290
19 #if (defined(WITH_LITE_STATIC) && defined(WITH_STATIC_LIB))
20 // Whether to output some warning messages when using the
21 // FastDepoy static library, default OFF. These messages
22 // are only reserve for debugging.
23 #if defined(WITH_STATIC_WARNING)
24 #warning You are using the FastDeploy static library. We will automatically add some registration codes for ops, kernels and passes for Paddle Lite. // NOLINT
25 #endif
26 #if !defined(WITH_STATIC_LIB_AT_COMPILING)
27 #include "paddle_use_ops.h" // NOLINT
28 #include "paddle_use_kernels.h" // NOLINT
29 #include "paddle_use_passes.h" // NOLINT
30 #endif
31 #endif
32 
33 #include <iostream>
34 #include <memory>
35 #include <string>
36 #include <vector>
37 #include <map>
38 
39 namespace fastdeploy {
40 
49 };
50 
55  int power_mode = 3;
56  // Number of threads while use CPU
57  int cpu_threads = 1;
59  bool enable_fp16 = false;
60  // Inference device, Paddle Lite support CPU/KUNLUNXIN/TIMVX/ASCEND
61  Device device = Device::CPU;
62  // Index of inference device
63  int device_id = 0;
64 
68  bool kunlunxin_locked = false;
70  bool kunlunxin_autotune = true;
72  std::string kunlunxin_autotune_file = "";
74  std::string kunlunxin_precision = "int16";
79 
81  std::string optimized_model_dir = "";
87  std::string nnadapter_context_properties = "";
89  std::string nnadapter_model_cache_dir = "";
93  std::map<std::string, std::vector<std::vector<int64_t>>>
96  std::vector<std::string> nnadapter_device_names = {};
97 };
98 } // namespace fastdeploy
std::vector< std::string > nnadapter_device_names
nnadapter_device_names
Definition: option.h:96
std::string nnadapter_model_cache_dir
nnadapter_model_cache_dir
Definition: option.h:89
Use Lite Backend with no bind power mode.
Definition: option.h:46
bool kunlunxin_enable_multi_stream
kunlunxin_enable_multi_stream
Definition: option.h:78
Use Lite Backend with low power mode.
Definition: option.h:44
std::string kunlunxin_precision
kunlunxin_precision
Definition: option.h:74
bool enable_fp16
Enable use half precision.
Definition: option.h:59
Use Lite Backend with rand high mode.
Definition: option.h:47
std::string kunlunxin_autotune_file
kunlunxin_autotune_file
Definition: option.h:72
std::string nnadapter_subgraph_partition_config_path
nnadapter_subgraph_partition_config_path
Definition: option.h:83
std::map< std::string, std::vector< std::vector< int64_t > > > nnadapter_dynamic_shape_info
nnadapter_dynamic_shape_info
Definition: option.h:94
std::string nnadapter_context_properties
nnadapter_context_properties
Definition: option.h:87
int kunlunxin_l3_workspace_size
kunlunxin_l3_workspace_size
Definition: option.h:66
LitePowerMode
Definition: option.h:42
Option object to configure Paddle Lite backend.
Definition: option.h:53
Use Lite Backend with high power mode.
Definition: option.h:43
int power_mode
Paddle Lite power mode for mobile device.
Definition: option.h:55
std::string nnadapter_subgraph_partition_config_buffer
nnadapter_subgraph_partition_config_buffer
Definition: option.h:85
bool kunlunxin_adaptive_seqlen
kunlunxin_adaptive_seqlen
Definition: option.h:76
std::string optimized_model_dir
Optimized model dir for CxxConfig.
Definition: option.h:81
std::string nnadapter_mixed_precision_quantization_config_path
nnadapter_mixed_precision_quantization_config_path
Definition: option.h:91
bool kunlunxin_locked
kunlunxin_locked
Definition: option.h:68
Use Lite Backend with rand low power mode.
Definition: option.h:48
bool kunlunxin_autotune
kunlunxin_autotune
Definition: option.h:70
All C++ FastDeploy APIs are defined inside this namespace.
Definition: option.h:16
Use Lite Backend with full power mode.
Definition: option.h:45