MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SetExternalContext

Method SetExternalContext

tensorflow/lite/interpreter.cc:105–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103Interpreter::~Interpreter() {}
104
105void Interpreter::SetExternalContext(TfLiteExternalContextType type,
106 TfLiteExternalContext* ctx) {
107 if (ctx == own_external_cpu_backend_context_.get()) {
108 error_reporter_->Report(
109 "WARNING: The passed external context is identical to the internally "
110 "owned one.");
111 return;
112 }
113
114 // We have an internally owned external context of kTfLiteCpuBackendContext.
115 // If it's overwritten here, we will release the resource of the internally
116 // owned external context.
117 // Note: the 'max thread count' info associated with the overwritten context
118 // will be lost here, and such info is now detemined by the new context, thus
119 // affecting how much parallelism a TFLite op would have.
120 if (kTfLiteCpuBackendContext == type &&
121 external_contexts_[kTfLiteCpuBackendContext] ==
122 own_external_cpu_backend_context_.get()) {
123 own_external_cpu_backend_context_.reset();
124 }
125
126 // This essentially changes the "external_contexts_[type]".
127 primary_subgraph().SetExternalContext(type, ctx);
128}
129
130TfLiteStatus Interpreter::SetInputs(std::vector<int> inputs) {
131 return primary_subgraph().SetInputs(inputs);

Callers 1

SetMethod · 0.45

Calls 3

getMethod · 0.45
ReportMethod · 0.45
resetMethod · 0.45

Tested by 1

SetMethod · 0.36