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
ee2d3cc3
Unverified
Commit
ee2d3cc3
authored
Feb 11, 2020
by
Wang Yucheng
Committed by
GitHub
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Frontend][TFlite] use qnn helper function in softmax (#4840)
parent
13f2155e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
9 deletions
+2
-9
python/tvm/relay/frontend/tflite.py
+2
-9
No files found.
python/tvm/relay/frontend/tflite.py
View file @
ee2d3cc3
...
@@ -439,8 +439,6 @@ class OperatorConverter(object):
...
@@ -439,8 +439,6 @@ class OperatorConverter(object):
output_tensors
=
self
.
get_output_tensors
(
op
)
output_tensors
=
self
.
get_output_tensors
(
op
)
assert
len
(
output_tensors
)
==
1
,
"output tensors length should be 1"
assert
len
(
output_tensors
)
==
1
,
"output tensors length should be 1"
output_tensor
=
output_tensors
[
0
]
output_tensor
=
output_tensors
[
0
]
output_tensor_type
=
output_tensor
.
tensor
.
Type
()
output_tensor_type_str
=
self
.
get_tensor_type_str
(
output_tensor_type
)
params
=
{
'axis'
:
1
}
# 1 is channel
params
=
{
'axis'
:
1
}
# 1 is channel
in_expr
=
self
.
get_expr
(
input_tensor_idx
)
in_expr
=
self
.
get_expr
(
input_tensor_idx
)
...
@@ -449,18 +447,13 @@ class OperatorConverter(object):
...
@@ -449,18 +447,13 @@ class OperatorConverter(object):
# dequantize to FP32 and perform softmax on FP32. We can investigate an integer only softmax
# dequantize to FP32 and perform softmax on FP32. We can investigate an integer only softmax
# implementation in future.
# implementation in future.
if
input_tensor
.
qnn_params
:
if
input_tensor
.
qnn_params
:
in_expr
=
_qnn
.
op
.
dequantize
(
data
=
in_expr
,
in_expr
=
self
.
dequantize
(
in_expr
,
input_tensor
)
input_scale
=
input_tensor
.
qnn_params
[
'scale'
],
input_zero_point
=
input_tensor
.
qnn_params
[
'zero_point'
])
out
=
_op
.
nn
.
softmax
(
in_expr
,
**
params
)
out
=
_op
.
nn
.
softmax
(
in_expr
,
**
params
)
# Go back to integer dataype if the original operator was quantized.
# Go back to integer dataype if the original operator was quantized.
if
output_tensor
.
qnn_params
:
if
output_tensor
.
qnn_params
:
out
=
_qnn
.
op
.
quantize
(
data
=
out
,
out
=
self
.
quantize
(
out
,
output_tensor
)
output_scale
=
output_tensor
.
qnn_params
[
'scale'
],
output_zero_point
=
output_tensor
.
qnn_params
[
'zero_point'
],
out_dtype
=
output_tensor_type_str
)
return
out
return
out
...
...
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