-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[q-implant-qparam-test] Introduce test cases (#11679)
This introduces test cases for q-implant-qparam-test. ONE-DCO-1.0-Signed-off-by: Seonguk Park [email protected]
- Loading branch information
Showing
23 changed files
with
897 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Add_000_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm1 | ||
json_content['ifm1'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ifm2 | ||
json_content['ifm2'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Add_000_Q8' | ||
|
||
_test_case_ = Add_000_Q8() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Add_001_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm1 | ||
json_content['ifm1'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ifm2 | ||
json_content['ifm2'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 0, 1)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Add_001_Q8' | ||
|
||
_test_case_ = Add_001_Q8() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Add_002_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm1 | ||
json_content['ifm1'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ifm2 | ||
json_content['ifm2'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 2, 2, 3)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Add_002_Q8' | ||
|
||
_test_case_ = Add_002_Q8() |
31 changes: 31 additions & 0 deletions
31
compiler/q-implant-qparam-test/qparam/AveragePool2D_000/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class AveragePool2D_000_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm | ||
json_content['ifm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'AveragePool2D_000_Q8' | ||
|
||
_test_case_ = AveragePool2D_000_Q8() |
38 changes: 38 additions & 0 deletions
38
compiler/q-implant-qparam-test/qparam/Concatenation_000/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Concatenation_000_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm1 | ||
json_content['ifm1'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ifm2 | ||
json_content['ifm2'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Concatenation_000_Q8' | ||
|
||
_test_case_ = Concatenation_000_Q8() |
47 changes: 47 additions & 0 deletions
47
compiler/q-implant-qparam-test/qparam/Conv2D_000/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Conv2D_000_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm | ||
json_content['ifm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ker | ||
json_content['ker'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 1, 1, 2)) # value_shape (OHWI) | ||
|
||
# Generate bias | ||
json_content['bias'] = gen_random_tensor( | ||
"int32", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Conv2D_000_Q8' | ||
|
||
_test_case_ = Conv2D_000_Q8() |
47 changes: 47 additions & 0 deletions
47
compiler/q-implant-qparam-test/qparam/Conv2D_001/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Conv2D_001_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm | ||
json_content['ifm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ker | ||
json_content['ker'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 1, 1, 2)) # value_shape (OHWI) | ||
|
||
# Generate bias | ||
json_content['bias'] = gen_random_tensor( | ||
"int32", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Conv2D_001_Q8' | ||
|
||
_test_case_ = Conv2D_001_Q8() |
47 changes: 47 additions & 0 deletions
47
compiler/q-implant-qparam-test/qparam/Conv2D_002/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Conv2D_002_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm | ||
json_content['ifm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ker | ||
json_content['ker'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 1, 1, 1)) # value_shape (OHWI) | ||
|
||
# Generate bias | ||
json_content['bias'] = gen_random_tensor( | ||
"int32", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Conv2D_002_Q8' | ||
|
||
_test_case_ = Conv2D_002_Q8() |
47 changes: 47 additions & 0 deletions
47
compiler/q-implant-qparam-test/qparam/Conv2D_003/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from test_utils import TestCase | ||
from test_utils import gen_random_tensor | ||
|
||
|
||
class Conv2D_003_Q8(TestCase): | ||
def __init__(self): | ||
self.name = _name_ | ||
|
||
def generate(self) -> dict: | ||
json_content = dict() | ||
|
||
# Generate ifm | ||
json_content['ifm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
# Generate ker | ||
json_content['ker'] = gen_random_tensor( | ||
"uint8", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1, 3, 3, 1)) # value_shape (OHWI) | ||
|
||
# Generate bias | ||
json_content['bias'] = gen_random_tensor( | ||
"int32", #dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0, # quantized_dimension | ||
(1)) # value_shape | ||
|
||
# Generate ofm | ||
json_content['ofm'] = gen_random_tensor( | ||
"uint8", # dtype_str | ||
(1), # scale_shape | ||
(1), # zerop_shape | ||
0) # quantized_dimension | ||
|
||
return json_content | ||
|
||
|
||
_name_ = 'Conv2D_003_Q8' | ||
|
||
_test_case_ = Conv2D_003_Q8() |
Oops, something went wrong.