Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hack auc for dense vector labels #5274

Merged

Conversation

typhoonzero
Copy link
Contributor

Fix #5124
Fix #1291

@typhoonzero typhoonzero changed the title Hack auc for multibin labels Hack auc for dense vector labels Nov 1, 2017
}

void hl_vector_cast2int(int* out, real* vec, int size) {
keVectorCast2Int<<<1, 512>>>(out, vec, size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to keep same with the old framework.

keVectorCast2Int<<<1, 512, 0, STREAM_DEFAULT>>>(xxx);
CHECK_SYNC("hl_vector_cast2int failed");

} else {
for (size_t i = 0; i < getSize(); ++i) {
ret->getData()[i] = int(this->getData()[i]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

从这个函数的实现来,ret, this同在GPU上,或同在CPU上。

如果这样castToInt(bool useGpu)函数接口里的useGpu参数可以去掉,使用this的状态判断即可。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Done. Updated.

// label width is 1
CHECK_EQ(1, labelval->getWidth());
auto tmp = labelval->getTranspose(); // do *not* copy
VectorPtr vec = Vector::create(tmp->getRowBuf(0), insNum, output->useGpu());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call the getTranspose()?

Line 412 can write as follow?

VectorPtr vec = Vector::create(labelval->getData(), insNum, output->useGpu());

* @param[in] size size of the vector.
*/
extern void hl_vector_cast2int(int* out, real* vec, int size);

Copy link
Contributor

@qingqing01 qingqing01 Nov 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it also needs to add this function into the file cuda/include/stub/hl_matrix_stub.h for the ONLY_CPU compiling.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks, this should be the correct way instead of add #ifdef in Vector.cpp

@typhoonzero typhoonzero merged commit cdd1da3 into PaddlePaddle:develop Nov 2, 2017
@jacquesqiao jacquesqiao mentioned this pull request Dec 9, 2017
@typhoonzero typhoonzero deleted the hack_auc_for_multibin_labels branch December 22, 2017 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants