-
Notifications
You must be signed in to change notification settings - Fork 157
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
[DRAFT][dredd] Introduce dredd test for TensorShape #14050
Conversation
related : #13998 |
@nnfw-bot test nncc-debug nncc-release |
@@ -0,0 +1,33 @@ | |||
# padding with dynamic shape, others same as Pad_000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This recipe and rule ard designed for shape Inference.
How about changing Pad_002
directory to Inf_Pad_00x
to separate it from other tests like Net_Conv_Add_00x
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing
Pad_002
directory toInf_Pad_00x
to separate it from other tests likeNet_Conv_Add_00x
?
Nice idea!
I'll change it.
Introduce new dredd-rule for check tensors shape. ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com
ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com
bfb9c6f
to
2178227
Compare
ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work well!
I left a few minor comments.
compiler/circle-inspect/src/Dump.cpp
Outdated
const auto tensor = tensors->Get(i); | ||
auto shape = tensor->shape_signature() ? tensor->shape_signature() : tensor->shape(); | ||
os << reader.tensor_name(tensor) << " "; | ||
for (int8_t i = 0; i < shape->size(); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a must, but most machines do calculations in 32-bit units, so there's probably no need to reduce it to 8-bit in for loop
.
for (int8_t i = 0; i < shape->size(); i++) | |
for (uint32_t i = 0; i < shape->size(); i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a must, but most machines do calculations in 32-bit units, so there's probably no need to reduce it to 8-bit in
for loop
.
I'll update it.
RULE "VERIFY_FILE_FORMAT" $(verify_file_format) '=' 1 | ||
|
||
RULE "PAD_EXIST" $(op_count PAD) '=' 1 | ||
RULE "PAD_SHAPE" $(tensor_shape ofm) '=' 1,-1,7,2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'shape' expression 1,-1,7,2
is fine now, but it would be better to express it in a more formalized form like [1, -1, 7, 2]
.
It would be better if it could handle spaces between commas as well.
RULE "PAD_SHAPE" $(tensor_shape ofm) '=' 1,-1,7,2 | |
RULE "PAD_SHAPE" $(tensor_shape ofm) '=' [1, -1, 7, 2] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from ##13998 (comment)
FYI) RULE "PAD_SHAPE" $(tensor_shape ofm) '=' [1, -1, 7, 2] does not work with the current code. Currently, the rule only works if the arguments have exactly 4 elements, so there cannot be any spaces in between, such as [1, -1, 7, 2]. Therefore, at the moment, we are checking shapes in the form of 1,-1,7,2.
- Current code
ONE/compiler/dredd-rule-lib/rule-lib.sh
Lines 85 to 92 in 646c7f1
RULE() { argc_check $# 4 RULE_NAME=$1 ACTUAL=$2 COND=$3 EXPECTED=$4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks for the description.
How about using a quoted string, i.e., "[1, -1, 7, 2]"
?
If it's difficult, the current implementation is not bad either =)
@@ -0,0 +1,6 @@ | |||
# To check if dynamic dimension properly infered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
=)
# To check if dynamic dimension properly infered | |
# To check if dynamic dimension properly inferred |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo =)
Sorry, I'll fix it.
@@ -96,6 +96,7 @@ Add(PadV2_001 PASS substitute_padv2_to_pad) | |||
Add(Softmax_001 PASS decompose_softmax) | |||
Add(Softmax_002 PASS decompose_softmax) | |||
Add(StridedSlice_003 PASS substitute_strided_slice_to_reshape) | |||
Add(Inf_Pad_000 PASS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort in alphabetical order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort in alphabetical order
Instead of sorting, what about separate Inf_
tests?
Add(Inf_Pad_000 PASS) | |
# Shape Inference test | |
Add(Inf_Pad_000 PASS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
, what about separate
Inf_
tests?
👍
change rule shape to be enclosed in brackets change type to uint32_t seperate inference test list ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com
51db89a
to
9242803
Compare
|
||
RULE "VERIFY_FILE_FORMAT" $(verify_file_format) '=' 1 | ||
|
||
RULE "PAD_EXIST" $(op_count PAD) '=' 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, PAD_EXIST
is not related to SHAPE_INFERENCE.
Why is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
You're right.
ONE-DCO-1.0-Signed-off-by: sunki <ajsthfldu@outlook.com>
remove unneccesary rule for shape inference. ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com
Introduce new dredd-rule for tensors shape.
ONE-DCO-1.0-Signed-off-by: JuYoung Lee rsb98759@gmail.com