mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 13:16:32 -06:00
* dnn: fix Pow with an integer base and a float exponent The output keeps the base type, and the exponent was converted to it before the power was computed, so x^0.5 became x^0. Compute in double and truncate toward zero, as onnxruntime does. Florence-2's vision encoder computes sqrt(num_patches) this way to build a Reshape shape, which made the Reshape fail. * dnn: call std::pow for Pow with an integer base and a float exponent A single exponent went through cv::pow, whose exp(y*log(x)) can land one ulp below an exact integer (4^1.5 = 7.99..), and truncation then gave 7 instead of 8. Compute each element with std::pow, as onnxruntime does. The new test uses a constant scalar exponent, as Florence-2 does.