未验证 提交 31ad53f8 编写于 作者: Y yaoxuefeng 提交者: GitHub

mod cvm test=develop (#25146) (#26527)

* mod cvm test=develop

* mod code format test=develop
上级 29493ff0
...@@ -68,9 +68,20 @@ class CVMOpKernel : public framework::OpKernel<T> { ...@@ -68,9 +68,20 @@ class CVMOpKernel : public framework::OpKernel<T> {
// for Input X do not have Lod Information. // for Input X do not have Lod Information.
if (x->NumLevels() == 0) { if (x->NumLevels() == 0) {
if (use_cvm) {
for (int i = 0; i < batch_size; i++) {
int cursor = i * item_size;
y_data[cursor] = log(x_data[cursor] + 1);
y_data[cursor + 1] = log(x_data[cursor + 1] + 1) - y_data[cursor];
for (int j = 2; j < item_size; j++) {
y_data[cursor + j] = x_data[cursor + j];
}
}
} else {
for (int i = 0; i < batch_size; i++) { for (int i = 0; i < batch_size; i++) {
CvmComputeKernel(use_cvm, item_size, &x_data, &y_data); CvmComputeKernel(use_cvm, item_size, &x_data, &y_data);
} }
}
} else { } else {
auto lod = x->lod()[0]; auto lod = x->lod()[0];
for (size_t i = 0; i < lod.size() - 1; ++i) { for (size_t i = 0; i < lod.size() - 1; ++i) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册