MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / scale

Method scale

src/custom/impl/tensor.cpp:332–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332float 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
347uint8_t DType::zero_point() const {
348 mgb_assert(

Callers 3

load_dtypeFunction · 0.45
bad_opr_shallow_copyFunction · 0.45
TESTFunction · 0.45

Calls 2

strFunction · 0.85
getMethod · 0.45

Tested by 2

bad_opr_shallow_copyFunction · 0.36
TESTFunction · 0.36