| 330 | } |
| 331 | |
| 332 | float DType::scale() const { |
| 333 | if (enumv() == DTypeEnum::qint8) { |
| 334 | return DTypeImplRef(m_impl.get()).param<dtype::QuantizedS8>().scale; |
| 335 | } else if (enumv() == DTypeEnum::qint16) { |
| 336 | return DTypeImplRef(m_impl.get()).param<dtype::QuantizedS16>().scale; |
| 337 | } else if (enumv() == DTypeEnum::qint32) { |
| 338 | return DTypeImplRef(m_impl.get()).param<dtype::QuantizedS32>().scale; |
| 339 | } else if (enumv() == DTypeEnum::quint8) { |
| 340 | return DTypeImplRef(m_impl.get()).param<dtype::Quantized8Asymm>().scale; |
| 341 | } else { |
| 342 | mgb_assert(false, "dtype %s has no scale", str().c_str()); |
| 343 | return 0.f; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | uint8_t DType::zero_point() const { |
| 348 | mgb_assert( |