提交 1a8cbb67 编写于 作者: J JiabinYang

test=develop, accelerate_hs_op and add prefetch with is_sparse

上级 1bec52f5
...@@ -40,8 +40,9 @@ using platform::Transform; ...@@ -40,8 +40,9 @@ using platform::Transform;
static std::vector<int64_t> PathToRows(const framework::LoDTensor& path) { static std::vector<int64_t> PathToRows(const framework::LoDTensor& path) {
std::set<int64_t> rows; std::set<int64_t> rows;
const int64_t* paths = path.data<int64_t>();
for (int64_t i = 0; i < path.numel(); ++i) { for (int64_t i = 0; i < path.numel(); ++i) {
int64_t row = path.data<int64_t>()[i]; int64_t row = paths[i];
if (row < 0) { if (row < 0) {
continue; continue;
} }
......
...@@ -5013,9 +5013,10 @@ def nce(input, ...@@ -5013,9 +5013,10 @@ def nce(input,
else: else:
num_neg_samples = int(num_neg_samples) num_neg_samples = int(num_neg_samples)
remote_prefetch = False remote_prefetch = is_sparse
if os.environ.get('PADDLE_ENABLE_REMOTE_PREFETCH'): print(
remote_prefetch = True "With sparse mode, if your models has only small parameter prefetch may cause speed down"
)
attrs = { attrs = {
'num_total_classes': int(num_total_classes), 'num_total_classes': int(num_total_classes),
...@@ -5133,10 +5134,10 @@ def hsigmoid(input, ...@@ -5133,10 +5134,10 @@ def hsigmoid(input,
pass pass
weights = None weights = None
remote_prefetch = False remote_prefetch = is_sparse
if os.environ.get('PADDLE_ENABLE_REMOTE_PREFETCH'): print(
remote_prefetch = True "With sparse mode, if your models has only small parameter prefetch may cause speed down"
)
if not is_custom: if not is_custom:
weights = helper.create_parameter( weights = helper.create_parameter(
attr=helper.param_attr, attr=helper.param_attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册