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
d7998d39
Commit
d7998d39
authored
Sep 26, 2019
by
Animesh Jain
Committed by
Zhi
Sep 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[QNN][Conv2D] Optimize lowering. (#4006)
parent
b330d301
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
src/relay/qnn/op/convolution.cc
+11
-10
No files found.
src/relay/qnn/op/convolution.cc
View file @
d7998d39
...
...
@@ -217,15 +217,6 @@ Expr Conv2DSecondTerm(const Expr& padded_data, const Expr& zp_kernel, const QnnC
auto
scaled_hw_t2
=
Multiply
(
casted_t2
,
MakeConstantScalar
(
Int
(
32
),
kernel_h
*
kernel_w
));
Array
<
IndexExpr
>
padding
({
0
,
0
});
// If the pool_size is 1x1, we don't need avg_pool2d.
auto
reduced_hw_t2
=
scaled_hw_t2
;
if
(
kernel_h
*
kernel_w
!=
1
)
{
reduced_hw_t2
=
AvgPool2D
(
scaled_hw_t2
,
param
->
kernel_size
,
param
->
strides
,
padding
,
param
->
data_layout
,
false
,
// ceil_mode
false
);
// count_include_pad
}
// Reduce the C dimension. Find the dimension.
Array
<
Integer
>
axes_t2
;
if
(
param
->
data_layout
==
"NCHW"
)
{
...
...
@@ -236,7 +227,17 @@ Expr Conv2DSecondTerm(const Expr& padded_data, const Expr& zp_kernel, const QnnC
LOG
(
FATAL
)
<<
"qnn.conv2d does not support "
<<
param
->
data_layout
<<
" layout"
;
}
// Keep dims true to retain 4D tensor
auto
reduced_t2
=
Sum
(
reduced_hw_t2
,
axes_t2
,
true
,
false
);
auto
reduced_c_t2
=
Sum
(
scaled_hw_t2
,
axes_t2
,
true
,
false
);
// If the pool_size is 1x1, we don't need avg_pool2d.
auto
reduced_t2
=
reduced_c_t2
;
if
(
kernel_h
*
kernel_w
!=
1
)
{
reduced_t2
=
AvgPool2D
(
reduced_c_t2
,
param
->
kernel_size
,
param
->
strides
,
padding
,
param
->
data_layout
,
false
,
// ceil_mode
false
);
// count_include_pad
}
auto
multiplied_t2
=
reduced_t2
;
if
(
param
->
kernel_zero_point
!=
1
)
{
multiplied_t2
=
Multiply
(
zp_kernel
,
reduced_t2
);
...
...
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