Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[ONNX] Fixed floating point workflow (#30545)

Georgy Krivoruchkof347a9612e48
diff --git a/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp b/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
index 4b401bbd2f9..18c306e1aae 100644
--- a/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
+++ b/src/frontends/onnx/frontend/src/op/com.microsoft/matmulnbits.cpp
@@ -45,7 +45,7 @@ ov::OutputVector matmulnbits(const ov::frontend::onnx::Node& node) {
4); // required, in docs: number of bits used for weight quantization (default 4)
const uint64_t n_blocks_per_col = (K + block_size - 1) / block_size;
- const auto blob_size = static_cast<int64_t>(ceil(block_size * bits / 8));
+ const auto blob_size = (block_size * bits + 7) / 8;
CHECK_VALID_NODE(node, n_blocks_per_col > 0, "Wrong blocks count: ", n_blocks_per_col);
CHECK_VALID_NODE(node, blob_size > 0, "Wrong blob size: ", blob_size);
@@ -214,4 +214,4 @@ ONNX_OP("MatMulNBits", OPSET_SINCE(1), com_microsoft::opset_1::matmulnbits, MICR
} // namespace com_microsoft
} // namespace onnx
} // namespace frontend
-} // namespace ov
\ No newline at end of file
+} // namespace ov