Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
a4902e05
Unverified
Commit
a4902e05
authored
Apr 18, 2020
by
shoubhik
Committed by
GitHub
Apr 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove developer facing api from frontend exports. (#5375)
parent
4672dc76
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
+19
-23
python/tvm/relay/frontend/__init__.py
+0
-4
tests/python/frontend/mxnet/test_qnn_ops_utils.py
+19
-19
No files found.
python/tvm/relay/frontend/__init__.py
View file @
a4902e05
...
...
@@ -24,10 +24,6 @@ for Relay.
from
__future__
import
absolute_import
from
.mxnet
import
from_mxnet
from
.mxnet_qnn_op_utils
import
dequantize_mxnet_min_max
from
.mxnet_qnn_op_utils
import
quantize_mxnet_min_max
from
.mxnet_qnn_op_utils
import
get_mkldnn_int8_scale
from
.mxnet_qnn_op_utils
import
get_mkldnn_uint8_scale
from
.mxnet_qnn_op_utils
import
quantize_conv_bias_mkldnn_from_var
from
.keras
import
from_keras
from
.onnx
import
from_onnx
...
...
tests/python/frontend/mxnet/test_qnn_ops_utils.py
View file @
a4902e05
...
...
@@ -16,10 +16,14 @@
# under the License.
import
tvm
from
tvm
import
te
import
numpy
as
np
from
tvm
import
relay
from
tvm.contrib
import
graph_runtime
from
tvm.relay.frontend.mxnet_qnn_op_utils
import
dequantize_mxnet_min_max
,
\
quantize_mxnet_min_max
,
\
get_mkldnn_int8_scale
,
\
get_mkldnn_uint8_scale
,
\
quantize_conv_bias_mkldnn_from_var
def
test_mkldnn_dequantize
():
...
...
@@ -29,11 +33,10 @@ def test_mkldnn_dequantize():
input_data
=
relay
.
var
(
"input_data"
,
shape
=
shape
,
dtype
=
in_dtype
)
min_range
=
quant_args
[
'min_range'
]
max_range
=
quant_args
[
'max_range'
]
dequantized_output
=
\
relay
.
frontend
.
dequantize_mxnet_min_max
(
input_data
,
min_range
=
min_range
,
max_range
=
max_range
,
in_dtype
=
in_dtype
)
dequantized_output
=
dequantize_mxnet_min_max
(
input_data
,
min_range
=
min_range
,
max_range
=
max_range
,
in_dtype
=
in_dtype
)
mod
=
relay
.
Function
(
relay
.
analysis
.
free_vars
(
dequantized_output
),
dequantized_output
)
mod
=
tvm
.
IRModule
.
from_expr
(
mod
)
with
relay
.
build_config
(
opt_level
=
3
):
...
...
@@ -79,17 +82,15 @@ def test_mkldnn_dequantize():
def
test_mkldnn_quantize
():
def
quantize_test_driver
(
out_dtype
,
quant_args
,
in_data
,
verify_output_data
):
shape
=
in_data
.
shape
input_data
=
relay
.
var
(
"input_data"
,
shape
=
shape
,
dtype
=
'float32'
)
min_range
=
quant_args
[
'min_range'
]
max_range
=
quant_args
[
'max_range'
]
quantized_output
,
_
,
_
=
\
relay
.
frontend
.
quantize_mxnet_min_max
(
input_data
,
min_range
=
min_range
,
max_range
=
max_range
,
out_dtype
=
out_dtype
)
quantized_output
,
_
,
_
=
quantize_mxnet_min_max
(
input_data
,
min_range
=
min_range
,
max_range
=
max_range
,
out_dtype
=
out_dtype
)
mod
=
relay
.
Function
(
relay
.
analysis
.
free_vars
(
quantized_output
),
quantized_output
)
mod
=
tvm
.
IRModule
.
from_expr
(
mod
)
with
relay
.
build_config
(
opt_level
=
3
):
...
...
@@ -140,8 +141,8 @@ def test_get_mkldnn_int8_scale():
range_min
=
-
3.904039
range_max
=
3.904039
expected
=
0.03061991354976495
output
=
relay
.
frontend
.
get_mkldnn_int8_scale
(
range_max
=
range_max
,
range_min
=
range_min
)
output
=
get_mkldnn_int8_scale
(
range_max
=
range_max
,
range_min
=
range_min
)
assert
np
.
allclose
(
output
,
expected
)
...
...
@@ -149,15 +150,15 @@ def test_get_mkldnn_uint8_scale():
range_min
=
0.0
range_max
=
55.77269
expected
=
0.21828841189047482
output
=
relay
.
frontend
.
get_mkldnn_uint8_scale
(
range_max
=
range_max
,
range_min
=
range_min
)
output
=
get_mkldnn_uint8_scale
(
range_max
=
range_max
,
range_min
=
range_min
)
assert
np
.
allclose
(
output
,
expected
)
def
test_quantize_conv_bias_mkldnn_from_var
():
bias_var
=
relay
.
var
(
'bias'
,
shape
=
(
3
,),
dtype
=
'float32'
)
bias_scale
=
tvm
.
nd
.
array
(
np
.
array
([
0.5
,
0.6
,
0.7
]))
output
=
relay
.
frontend
.
quantize_conv_bias_mkldnn_from_var
(
bias_var
,
bias_scale
)
output
=
quantize_conv_bias_mkldnn_from_var
(
bias_var
,
bias_scale
)
assert
isinstance
(
output
,
tvm
.
relay
.
expr
.
Call
)
attrs
=
output
.
attrs
assert
attrs
.
axis
==
0
...
...
@@ -171,4 +172,4 @@ if __name__ == "__main__":
test_mkldnn_quantize
()
test_get_mkldnn_int8_scale
()
test_get_mkldnn_uint8_scale
()
test_quantize_conv_bias_mkldnn_from_var
()
\ No newline at end of file
test_quantize_conv_bias_mkldnn_from_var
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment