| 383 | } |
| 384 | |
| 385 | void Clamp(OpKernelContext* tf_context, const quint8* input, int count, |
| 386 | quint8 clamp_min, quint8 clamp_max, quint8* output) { |
| 387 | #ifdef TENSORFLOW_USE_META |
| 388 | mutex_lock library_lock(GetMutex()); |
| 389 | typedef gemmlowp::meta::Transform1DParams<uint8_t, uint8_t, |
| 390 | gemmlowp::meta::MinMax<uint8_t>> |
| 391 | Params; |
| 392 | |
| 393 | Params params; |
| 394 | params.input = reinterpret_cast<const uint8_t*>(input); |
| 395 | params.output = reinterpret_cast<uint8_t*>(output); |
| 396 | params.kernel.count = count; |
| 397 | params.kernel.min = clamp_min; |
| 398 | params.kernel.max = clamp_max; |
| 399 | |
| 400 | MultiThreadTransform1D<Params, 16>(tf_context, params); |
| 401 | #else |
| 402 | LOG(FATAL) << "Clamp: Meta fastpath not supported."; |
| 403 | #endif |
| 404 | } |
| 405 | |
| 406 | } // namespace meta |
| 407 | } // namespace tensorflow |