diff --git a/src/core/src/op/random_uniform.cpp b/src/core/src/op/random_uniform.cpp index 9f38daed887..0b0980208e6 100644 --- a/src/core/src/op/random_uniform.cpp +++ b/src/core/src/op/random_uniform.cpp @@ -41,8 +41,11 @@ void op::v8::RandomUniform::validate_and_infer_types() { NODE_VALIDATION_CHECK(this, input_shape.rank() == 1, "The rank of the tensor defining output shape must be equal to 1."); + if (const auto& const_shape = get_constant_from_source(input_value(0))) { output_shape = ov::PartialShape(const_shape->cast_vector()); + } else { + output_shape = ov::PartialShape::dynamic(input_shape[0]); } } diff --git a/src/core/tests/type_prop/random_uniform.cpp b/src/core/tests/type_prop/random_uniform.cpp index eb470cf342e..4754c2e63f3 100644 --- a/src/core/tests/type_prop/random_uniform.cpp +++ b/src/core/tests/type_prop/random_uniform.cpp @@ -21,6 +21,17 @@ TEST(type_prop, random_uniform_type_shape) { EXPECT_TRUE(r->get_output_partial_shape(0).same_scheme(PartialShape{2, 3, 4, 5})); } +TEST(type_prop, random_uniform_param_input) { + auto out_shape = make_shared(element::i32, PartialShape{3}); + auto min_val = make_shared(element::i64, Shape{}, 5); + auto max_val = make_shared(element::i64, Shape{}, 10); + + auto r = make_shared(out_shape, min_val, max_val, element::i64, 100, 200); + + EXPECT_EQ(r->get_output_element_type(0), element::i64); + EXPECT_EQ(r->get_output_partial_shape(0), PartialShape::dynamic(3)); +} + TEST(type_prop, random_uniform_dynamic_shape) { auto out_shape = make_shared(element::i32, PartialShape{Dimension::dynamic()}); auto min_val = make_shared(element::i64, Shape{}, 5);