未验证 提交 7aa608a5 编写于 作者: J jakpiase 提交者: GitHub

fix for bias caching and scales optimization (#47234)

上级 40212582
......@@ -164,17 +164,16 @@ class FCMKLDNNHandler
? 1.0f
: ctx.Attr<float>("Scale_out");
const size_t weight_scales_num = scale_weights_data.size();
std::vector<float> output_shift_scale(weight_scales_num);
for (size_t i = 0; i < weight_scales_num; i++) {
for (size_t i = 0; i < weight_scales_num; ++i) {
if (scale_weights_data[i] == 0.0)
output_shift_scale[i] = inner_scale;
scale_weights_data[i] = inner_scale;
else
output_shift_scale[i] =
scale_weights_data[i] =
inner_scale / (scale_in_data * scale_weights_data[i]);
}
return make_tuple(output_shift_scale, scale);
return make_tuple(scale_weights_data, scale);
}
// Computing MKL-DNN's scaling mask which determines along which dimension
......@@ -257,6 +256,7 @@ class FCMKLDNNHandler
this->fwd_pd_->bias_desc(),
to_void_cast<float>(bias_data),
attrs);
this->dev_ctx_.SetBlob(bias_key, memory_p);
}
return memory_p;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册