Skip to content

Commit edd3667

Browse files
committed
[Snippets] MHA tests: bf16 inputs generation restored
1 parent e23704e commit edd3667

File tree

1 file changed

+3
-1
lines changed
  • src/tests/functional/plugin/shared/src/snippets

1 file changed

+3
-1
lines changed

src/tests/functional/plugin/shared/src/snippets/mha.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ void MHA::generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticSha
8181
for (int i = 0; i < model_inputs.size(); ++i) {
8282
const auto& model_input = model_inputs[i];
8383
ov::Tensor tensor;
84-
tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), model_input.get_shape(), 2, -1, 256);
84+
// To avoid big relative errors in the vicinity of zero, only positive values are generated for bf16 precision
85+
int start_from = model_input.get_element_type() == ov::element::bf16 ? 0 : -1;
86+
tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), model_input.get_shape(), 2, start_from, 256);
8587
inputs.insert({model_input.get_node_shared_ptr(), tensor});
8688
}
8789
}

0 commit comments

Comments
 (0)