| 160 | } |
| 161 | |
| 162 | void DecrementUsageCounter(TfLiteContext* context) { |
| 163 | auto* ptr = GetEigenContext(context); |
| 164 | if (ptr == nullptr) { |
| 165 | TF_LITE_FATAL( |
| 166 | "Call to DecrementUsageCounter() not preceded by " |
| 167 | "IncrementUsageCounter()"); |
| 168 | } |
| 169 | if (--ptr->num_references == 0) { |
| 170 | delete ptr; |
| 171 | context->SetExternalContext(context, kTfLiteEigenContext, nullptr); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | const Eigen::ThreadPoolDevice* GetThreadPoolDevice(TfLiteContext* context) { |
| 176 | auto* ptr = GetEigenContext(context); |