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

some doubts about argmax_layer (may be bug) #6823

Open
2 of 5 tasks
WangJinyin opened this issue Aug 29, 2019 · 0 comments
Open
2 of 5 tasks

some doubts about argmax_layer (may be bug) #6823

WangJinyin opened this issue Aug 29, 2019 · 0 comments

Comments

@WangJinyin
Copy link

WangJinyin commented Aug 29, 2019

Issue summary

some doubts about argmax_layer.

Suppose out bottom blob is [[11, 12, 13, 14, 15, 16, 17, 18, 19, 20]], with shape (1, 10).

  • about LayerSetup

    if (has_axis_) { axis_ = bottom[0]->CanonicalAxisIndex(argmax_param.axis()); CHECK_GE(axis_, 0) << "axis must not be less than 0."; CHECK_LE(axis_, bottom[0]->num_axes()) <<"axis must be less than or equal to the number of axis."; CHECK_LE(top_k_, bottom[0]->shape(axis_)) << "top_k must be less than or equal to the dimension of the axis."; }

    The second check CHECK_LE(axis_, bottom[0]->num_axes()) should be CHECK_LT?

    First CHECK_GE(axis_, 0) and second check CHECK_LE(axis_, bottom[0]->num_axes()) are not required, because after CanonicalAxisIndex(argmax_param.axis()), 0 <= axis_ < num_axes().

  • when out_max_val = true, top_k = 5, has_axis = true, axis = 1

    The top blob will be [[20, 19, 18, 17, 16]], with shape (1, 5).
    But it should be [[[9, 8, 7, 6, 5], [20, 19, 18, 17, 16]]], with shape (1, 2, 5).

    When out_max_val = true and has_axis = true, we will lose max_index.
    Maybe we should add one dimension just before axis.

  • out_max_val = false, top_k = 5, has_axis = false

    The top blob will be [[[9, 8, 7, 6, 5]]], with shape (1, 1, 5).
    But it should be [[9, 8, 7, 6, 5]], with shape (1, 5).

    When num_axes of bottom blob less than 3, num_axes of top blob will be 3.
    But sometimes this is wrong.
    May be something worng with:
    if ( num_top_axes < 3 ) num_top_axes = 3; (argmax_layer.cpp line 37)

Steps to reproduce

Tried solutions

System configuration

  • Operating system:
  • Compiler:
  • CUDA version (if applicable):
  • CUDNN version (if applicable):
  • BLAS:
  • Python version (if using pycaffe):
  • MATLAB version (if using matcaffe):

Issue checklist

  • read the guidelines and removed the first paragraph
  • written a short summary and detailed steps to reproduce
  • explained how solutions to related problems failed (tick if found none)
  • filled system configuration
  • attached relevant logs/config files (tick if not applicable)
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

1 participant