[Snippets] MHA tests: bf16 inputs generation restored (#21250)

This commit is contained in:
Vladislav Golubev 2023-11-27 10:20:05 +01:00 committed by GitHub
parent 1a235ffe79
commit c50bd2b55f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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