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(argmaxparam.axis()), 0 <= axis < num_axes().
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
[x] read the guidelines and removed the first paragraph
[x] 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)
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 checkCHECK_LE(axis_, bottom[0]->num_axes())
are not required, because after CanonicalAxisIndex(argmaxparam.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
Issue checklist