diff --git a/src/frontends/onnx/frontend/src/op/random_uniform.cpp b/src/frontends/onnx/frontend/src/op/random_uniform.cpp index c1f89bc2049246..4090f5125b6925 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform.cpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform.cpp @@ -25,20 +25,18 @@ ov::OutputVector random_uniform(const ov::frontend::onnx::Node& node) { static_cast(TensorProto_DataType::TensorProto_DataType_FLOAT)); const auto high_const = node.get_attribute_as_constant("high", 1.0f); const auto low_const = node.get_attribute_as_constant("low", 0.0f); - const auto seed = node.get_attribute_value("seed", 0.0f); + const auto seed = common::convert_float_seed(node.get_attribute_value("seed", 0.0f)); const auto target_shape_const = node.get_attribute_as_constant>("shape"); const auto target_type = common::get_ov_element_type(dtype); const uint64_t global_seed = 0; - // TODO: This multiplication leads to a mismatch in accuracy. Issue: 123003 - const auto seed_uint64 = static_cast(seed * 1000); return {std::make_shared(target_shape_const, low_const, high_const, target_type, global_seed, - seed_uint64)}; + seed)}; } } // namespace set_1 diff --git a/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp b/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp index 917e6c6780edaa..e8c9093bdc85a6 100644 --- a/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp +++ b/src/frontends/onnx/frontend/src/op/random_uniform_like.cpp @@ -33,17 +33,16 @@ ov::OutputVector random_uniform_like(const ov::frontend::onnx::Node& node) { const auto high_const = node.get_attribute_as_constant("high", 1.0f); const auto low_const = node.get_attribute_as_constant("low", 0.0f); - const auto seed = node.get_attribute_value("seed", 0.f); + const auto seed = common::convert_float_seed(node.get_attribute_value("seed", 0.f)); const uint64_t global_seed = 0; - const auto seed_uint64 = static_cast(seed * 1000); return {std::make_shared(target_shape, low_const, high_const, target_type, global_seed, - seed_uint64)}; + seed)}; } } // namespace set_1 diff --git a/src/frontends/onnx/tests/onnx_import.in.cpp b/src/frontends/onnx/tests/onnx_import.in.cpp index e15e4e768b6505..b90baa2bbc4674 100644 --- a/src/frontends/onnx/tests/onnx_import.in.cpp +++ b/src/frontends/onnx/tests/onnx_import.in.cpp @@ -4949,7 +4949,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_random_uniform) { const auto model = convert_model("random_uniform.onnx"); auto test_case = ov::test::TestCase(model, s_device); - test_case.add_expected_output(Shape{2, 2}, {43.45518f, 48.67585f, 42.227386f, 40.86294f}); + test_case.add_expected_output(Shape{2, 2}, {43.70129f, 45.26042f, 43.48503f, 46.43743f}); test_case.run(); } @@ -4958,7 +4958,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_random_uniform_like) { auto test_case = ov::test::TestCase(model, s_device); test_case.add_input(Shape{2, 2}, {41, 42, 43, 44}); - test_case.add_expected_output(Shape{2, 2}, {43.45518f, 48.67585f, 42.227386f, 40.86294f}); + test_case.add_expected_output(Shape{2, 2}, {43.70129f, 45.26042f, 43.48503f, 46.43743f}); test_case.run(); } @@ -4966,7 +4966,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_random_normal) { const auto model = convert_model("random_normal.onnx"); auto test_case = ov::test::TestCase(model, s_device); - test_case.add_expected_output(Shape{2, 2}, {83.052017f, 55.496368f, 119.31188f, -3.6946249f}); + test_case.add_expected_output(Shape{2, 2}, {30.357481f, 72.41268f, 12.999034f, 70.04985f}); test_case.run(); } @@ -4975,7 +4975,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_random_normal_like) { auto test_case = ov::test::TestCase(model, s_device); test_case.add_input(Shape{2, 2}, {0, 0, 0, 0}); - test_case.add_expected_output(Shape{2, 2}, {83.052017f, 55.496368f, 119.31188f, -3.6946249f}); + test_case.add_expected_output(Shape{2, 2}, {30.357481f, 72.41268f, 12.999034f, 70.04985f}); test_case.run(); }