未验证 提交 618f7620 编写于 作者: T tangwei12 提交者: GitHub

add enforce for auc (#14687)

* add enforce for AUC,  test=develop
上级 41e19eb4
...@@ -75,8 +75,13 @@ class AucKernel : public framework::OpKernel<T> { ...@@ -75,8 +75,13 @@ class AucKernel : public framework::OpKernel<T> {
const auto *label_data = label->data<int64_t>(); const auto *label_data = label->data<int64_t>();
for (size_t i = 0; i < batch_size; i++) { for (size_t i = 0; i < batch_size; i++) {
uint32_t binIdx = static_cast<uint32_t>( auto predict_data = inference_data[i * inference_width + 1];
inference_data[i * inference_width + 1] * num_thresholds); PADDLE_ENFORCE_LE(predict_data, 1,
"The predict data must less or equal 1.");
PADDLE_ENFORCE_GE(predict_data, 0,
"The predict data must gather or equal 0.");
uint32_t binIdx = static_cast<uint32_t>(predict_data * num_thresholds);
if (label_data[i]) { if (label_data[i]) {
(*stat_pos)[binIdx] += 1.0; (*stat_pos)[binIdx] += 1.0;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册