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
6ecfaaff
Unverified
Commit
6ecfaaff
authored
Apr 09, 2020
by
shoubhik
Committed by
GitHub
Apr 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding support for TFLite QnnSub operator. (#5230)
parent
029388f5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
python/tvm/relay/frontend/tflite.py
+4
-3
tests/python/frontend/tflite/test_forward.py
+5
-2
No files found.
python/tvm/relay/frontend/tflite.py
View file @
6ecfaaff
...
...
@@ -926,8 +926,7 @@ class OperatorConverter(object):
"""Convert TFLite SUB"""
# Check if the input tensor is quantized, call QNN op
if
self
.
is_quantized
(
op
):
raise
tvm
.
error
.
OpNotImplemented
(
'TFlite quantized SUB operator is not supported yet.'
)
return
self
.
_convert_elemwise
(
_qnn
.
op
.
subtract
,
op
)
return
self
.
_convert_elemwise
(
_op
.
subtract
,
op
)
def
convert_mul
(
self
,
op
):
...
...
@@ -1355,7 +1354,9 @@ class OperatorConverter(object):
if
is_depthwise_conv
:
params
[
'channels'
]
=
int
(
in_channels
)
params
[
'groups'
]
=
int
(
input_c
)
params
[
'kernel_layout'
]
=
'HWOI'
# If number of input channels is 1, treat as normal
# convolution.
params
[
'kernel_layout'
]
=
'HWIO'
if
input_c
==
1
else
'HWOI'
else
:
params
[
'channels'
]
=
int
(
output_channels
)
params
[
'kernel_layout'
]
=
'HWIO'
...
...
tests/python/frontend/tflite/test_forward.py
View file @
6ecfaaff
...
...
@@ -541,6 +541,8 @@ def test_forward_convolution():
_test_convolution
([
4
,
17
,
17
,
124
],
[
1
,
1
,
124
,
1
],
[
1
,
1
],
[
1
,
1
],
'SAME'
,
'NHWC'
,
True
)
_test_convolution
([
4
,
17
,
17
,
12
],
[
3
,
3
,
12
,
1
],
[
1
,
1
],
[
2
,
2
],
'VALID'
,
'NHWC'
,
True
)
_test_convolution
([
4
,
17
,
17
,
12
],
[
3
,
3
,
12
,
2
],
[
1
,
1
],
[
2
,
2
],
'VALID'
,
'NHWC'
,
True
)
# dephtwise convolution with single input channel
_test_convolution
([
1
,
76
,
64
,
1
],
[
9
,
5
,
1
,
96
],
[
1
,
1
],
[
1
,
1
],
'SAME'
,
'NHWC'
,
True
)
#######################################################################
...
...
@@ -902,9 +904,9 @@ def _test_add(data, fused_activation_function=None, quantized=False, qnn_op=None
# Subtract
# --------
def
_test_sub
(
data
,
fused_activation_function
=
None
):
def
_test_sub
(
data
,
fused_activation_function
=
None
,
quantized
=
False
,
qnn_op
=
None
):
""" One iteration of subtract """
return
_test_elemwise
(
math_ops
.
subtract
,
data
,
fused_activation_function
)
return
_test_elemwise
(
math_ops
.
subtract
,
data
,
fused_activation_function
,
quantized
,
qnn_op
)
#######################################################################
# Mul
# ---
...
...
@@ -1036,6 +1038,7 @@ def test_all_elemwise():
_test_forward_elemwise
(
partial
(
_test_add
,
fused_activation_function
=
"RELU"
))
_test_forward_elemwise
(
partial
(
_test_add
,
fused_activation_function
=
"RELU6"
))
_test_forward_elemwise
(
_test_sub
)
_test_forward_elemwise_quantized
(
_test_sub
)
_test_forward_elemwise
(
partial
(
_test_sub
,
fused_activation_function
=
"RELU"
))
_test_forward_elemwise
(
partial
(
_test_sub
,
fused_activation_function
=
"RELU6"
))
_test_forward_elemwise
(
_test_mul
)
...
...
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