-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Hack auc for dense vector labels #5274
Conversation
… refine_evaluator_ops
… hack_auc_for_multibin_labels
paddle/cuda/src/hl_cuda_matrix.cu
Outdated
} | ||
|
||
void hl_vector_cast2int(int* out, real* vec, int size) { | ||
keVectorCast2Int<<<1, 512>>>(out, vec, size); |
There was a problem hiding this comment.
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");
paddle/math/Vector.cpp
Outdated
} else { | ||
for (size_t i = 0; i < getSize(); ++i) { | ||
ret->getData()[i] = int(this->getData()[i]); | ||
} |
There was a problem hiding this comment.
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
的状态判断即可。
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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); | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Fix #5124
Fix #1291