[GPU] Add additional handling of fused activations for OneDNN primitives (#8004)

This commit is contained in:
Sergey Shlyapnikov 2021-10-15 09:31:49 +03:00 committed by GitHub
parent 897cd09a5a
commit 8ea9986896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -783,6 +783,17 @@ protected:
}
}
if (cldnn_post_ops.size() && arg.get_fused_activations_funcs().size())
throw std::runtime_error("Unsupported mix of fused ops and activations");
for (size_t i = 0; i < arg.get_fused_activations_funcs().size(); i++) {
auto activation_type = arg.get_fused_activations_funcs()[i];
auto params = arg.get_fused_activations_params()[i];
dnnl::algorithm alg = onednn::convert_activation_func(activation_type);
post_ops.append_eltwise(1.0f, alg, params.a, params.b);
update_onednn_post_op_list(onednn_post_op_type::eltwise_act, empty_mem);
}
// Update total onednn post-ops info
onednn_fusing_map.emplace(arg.id(), std::move(fused_ops));