Check whether two quantization info are equal. * * @param[in] lhs RHS quantization info. * @param[in] rhs LHS quantization info. * * @return True if the given quantization info is the same. */
| 202 | * @return True if the given quantization info is the same. |
| 203 | */ |
| 204 | inline bool operator==(const QuantizationInfo &lhs, const QuantizationInfo &rhs) |
| 205 | { |
| 206 | const bool lhs_is_uniform = lhs.scale().size() < 2 && lhs.offset().size() < 2; |
| 207 | const bool rhs_is_uniform = rhs.scale().size() < 2 && rhs.offset().size() < 2; |
| 208 | |
| 209 | if (lhs_is_uniform && rhs_is_uniform) |
| 210 | { |
| 211 | const auto lhs_qinfo = lhs.uniform(); |
| 212 | const auto rhs_qinfo = rhs.uniform(); |
| 213 | |
| 214 | return (lhs_qinfo.scale == rhs_qinfo.scale) && (lhs_qinfo.offset == rhs_qinfo.offset); |
| 215 | } |
| 216 | |
| 217 | return (lhs.scale() == rhs.scale()) && (lhs.offset() == rhs.offset()); |
| 218 | } |
| 219 | |
| 220 | /** Check whether two quantization info are not equal. |
| 221 | * |