| 290 | } |
| 291 | |
| 292 | void Dequantize(OpKernelContext* tf_context, const quint8* input, int count, |
| 293 | float range_min, float range_max, float* output) { |
| 294 | #ifdef TENSORFLOW_USE_META |
| 295 | mutex_lock library_lock(GetMutex()); |
| 296 | typedef gemmlowp::meta::Transform1DParams<uint8_t, float, |
| 297 | gemmlowp::meta::Dequantize> |
| 298 | Params; |
| 299 | |
| 300 | Params params; |
| 301 | params.input = reinterpret_cast<const uint8_t*>(input); |
| 302 | params.output = reinterpret_cast<float*>(output); |
| 303 | params.kernel.count = count; |
| 304 | params.kernel.range_min = range_min; |
| 305 | params.kernel.range_scale = |
| 306 | CalculateRangeScale<uint8_t>(range_min, range_max); |
| 307 | params.kernel.range_offset = |
| 308 | static_cast<float>(std::numeric_limits<uint8_t>::lowest()); |
| 309 | |
| 310 | MultiThreadTransform1D<Params, 16>(tf_context, params); |
| 311 | #else |
| 312 | LOG(FATAL) << "Dequantize: Meta fastpath not supported."; |
| 313 | #endif |
| 314 | } |
| 315 | |
| 316 | void Quantize(OpKernelContext* tf_context, const float* input, int count, |
| 317 | float range_min, float range_max, quint8* output) { |