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

Added support for dim equals 2 in activation functions #9655

Merged

Conversation

kbinias
Copy link
Contributor

@kbinias kbinias commented Apr 4, 2018

It is important for RNN Search

@kbinias kbinias added the Intel label Apr 4, 2018
@kbinias kbinias requested a review from luotao1 April 4, 2018 13:24
Copy link
Collaborator

@wangkuiyi wangkuiyi left a comment

Choose a reason for hiding this comment

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

Thanks to @kbinias for this PR! Just a few of my cents.

auto dst_memory = mkldnn::memory({data_md, mkldnn_engine}, (void *)dst_data);
auto src_memory =
mkldnn::memory({data_md, mkldnn_engine},
static_cast<void *>(const_cast<float *>(src_data)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see that we need const_cast here because we made the type of src_data const auto* in L37. Therefore, I think that instead of removing the const decorator here, we should remove the const from the definition in L37. Am I right?

The change in my mind is something like the following:

  1. in L37, instead of

    const auto *src_data = src->template data<T>();

    we should have

    auto *src_data = src->template data<T>();
  2. Here, we could have

    mkldnn::memory src_mem = mkldnn::memory({data_md, mkldnn_engine},
           static_cast<void*>(src_data));

auto src_memory =
mkldnn::memory({data_md, mkldnn_engine},
static_cast<void *>(const_cast<float *>(src_data)));
auto dst_memory =
Copy link
Collaborator

Choose a reason for hiding this comment

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

The type auto here is a little misleading. We are following Google C++ style in PaddlePaddle, so I'd thought that mkldnn::memory is a function, whose type is unknown until we check the documentation. This made me confused with that exact type auto is. How about

mkldnn::memory dst_memory = mkldnn::memory(...)

@luotao1 luotao1 merged commit ec89ed6 into PaddlePaddle:develop Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants