| 126 | } |
| 127 | |
| 128 | Status InferenceContext::InitFromGraph(const CreateInferenceInfo& create_info, |
| 129 | const GraphFloat32& graph, |
| 130 | Environment* env) { |
| 131 | precision_ = create_info.precision; |
| 132 | storage_type_ = create_info.storage_type; |
| 133 | if (env->device().vendor() == Vendor::MALI) { |
| 134 | need_flush_ = true; |
| 135 | need_manual_release_ = true; |
| 136 | } |
| 137 | CopyInAndOutIds(graph); |
| 138 | CreationContext creation_context; |
| 139 | creation_context.device = env->GetDevicePtr(); |
| 140 | creation_context.context = &env->context(); |
| 141 | creation_context.queue = env->queue(); |
| 142 | creation_context.cache = env->program_cache(); |
| 143 | RETURN_IF_ERROR( |
| 144 | ConvertOperations(creation_context, graph, create_info.hints)); |
| 145 | Merge(); |
| 146 | RETURN_IF_ERROR( |
| 147 | AllocateMemory(graph, env->device(), creation_context.context)); |
| 148 | BindMemoryToOperations(); |
| 149 | RETURN_IF_ERROR(Compile(creation_context)); |
| 150 | |
| 151 | TuningParameters tuning_parameters; |
| 152 | tuning_parameters.queue = env->profiling_queue(); |
| 153 | tuning_parameters.info = env->device().GetInfoPtr(); |
| 154 | if (create_info.hints.Check(ModelHints::kFastTuning)) { |
| 155 | tuning_parameters.tuning_type = TuningType::FAST; |
| 156 | } |
| 157 | RETURN_IF_ERROR(Tune(tuning_parameters)); |
| 158 | return OkStatus(); |
| 159 | } |
| 160 | |
| 161 | Status InferenceContext::InitFromGraphWithTransforms( |
| 162 | const CreateInferenceInfo& create_info, GraphFloat32* graph, |
no test coverage detected