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

将DataLayer直接作为evaluator的输入出core #1623

Closed
pengli09 opened this issue Mar 15, 2017 · 5 comments
Closed

将DataLayer直接作为evaluator的输入出core #1623

pengli09 opened this issue Mar 15, 2017 · 5 comments
Assignees

Comments

@pengli09
Copy link
Contributor

将DataLayer直接作为evaluator的输入时会出core:疑似DataLayer的forward()函数调用时机与其他layer不同,而evaluator并不会主动调用input的forward()函数,因此如果直接将DataLayer作为evaluator的输入,DataLayer的value和ids都将是空指针,导致出core。如下为可重现将问题的最小配置。

from paddle.trainer_config_helpers import *

dim = 4

define_py_data_sources2(
    train_list='train.list',
    test_list=None,
    module='data',
    obj='process',)

input = data_layer(name='input', size=dim)
label = data_layer(name='label', size=dim)
prob = fc_layer(input=input, size=4, act=SoftmaxActivation(), bias_attr=False)
classification_error_evaluator(input=input, label=label) # core here

outputs(sum_cost(prob))

settings(learning_method = AdamOptimizer(),
         batch_size = 5,
         learning_rate = 0)
@hedaoyuan
Copy link
Contributor

这个错误的原因是在构造neural network的时候label被优化掉了。将outputs(sum_cost(prob))修改成outputs(sum_cost(prob), label)可以避免这个core。

@hedaoyuan hedaoyuan self-assigned this Mar 15, 2017
@pengli09
Copy link
Contributor Author

虽然用你提供的方法可以避免这个core,但是labelclassification_error_evaluator()里面是用到了的,被优化掉不太合理也不符合直观,是否还是把这个bug修复一下呢?

@hedaoyuan
Copy link
Contributor

hedaoyuan commented Mar 16, 2017

这个会作为Bug看一下;不过当前的逻辑是evaluator并不是neural network的一部分,所以上面代码看起来是classification_error_evaluator里面用到了label,但实际上paddle在解析构造neural netwrok的时候是跳过这个语句的。
@reyoung paddle.v2里面对evaluator的处理也是一样的逻辑是吗?或者v2里是否有方法可以fix这个错误。

@pengli09
Copy link
Contributor Author

@reyoung @hedaoyuan 另外顺便提一下,如果将data_layer直接作为recurrent_layer_group的in_links,也会存在出core的情况,有可能和当前这个isssue是同一个问题导致的

@lcy-seso
Copy link
Contributor

I close this issue due to inactivity. please feel free to reopen it.

@pkuyym pkuyym closed this as completed Sep 13, 2017
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

No branches or pull requests

4 participants