| 1302 | } |
| 1303 | |
| 1304 | float TensorRTReplacePass::Impl::get_scale(DType data_type) { |
| 1305 | float scale = 1.f; |
| 1306 | #define cb(_dt) \ |
| 1307 | case DTypeTrait<_dt>::enumv: \ |
| 1308 | scale = data_type.param<_dt>().scale; \ |
| 1309 | break; |
| 1310 | switch (data_type.enumv()) { |
| 1311 | MEGDNN_FOREACH_QUANTIZED_DTYPE(cb); |
| 1312 | default: |
| 1313 | mgb_throw( |
| 1314 | InternalError, "invalid quantized data type: %s", data_type.name()); |
| 1315 | } |
| 1316 | return scale; |
| 1317 | #undef cb |
| 1318 | } |
| 1319 | |
| 1320 | bool TensorRTReplacePass::Impl::is_quantized_int8_operator(OperatorNodeBase* opr) { |
| 1321 | bool is_quantized = true; |