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
575d5369
Unverified
Commit
575d5369
authored
Apr 11, 2020
by
Huacong Yang
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RELAY][FRONTEND][CAFFE2] add Mul and ConvTranspose operator (#5302)
parent
f506c8b1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
python/tvm/relay/frontend/caffe2.py
+35
-0
No files found.
python/tvm/relay/frontend/caffe2.py
View file @
575d5369
...
...
@@ -172,6 +172,12 @@ class Add(Elemwise):
name
=
'add'
class
Mul
(
Elemwise
):
""" Operator converter for Mul.
"""
name
=
'multiply'
class
Pool
(
Caffe2OpConverter
):
""" A helper class for pool op converters.
"""
...
...
@@ -233,6 +239,33 @@ class Conv(Caffe2OpConverter):
return
out
class
ConvTranspose
(
Caffe2OpConverter
):
""" Operator converter for ConvTranspose.
"""
@classmethod
def
_impl
(
cls
,
inputs
,
args
,
params
):
# get number of channels
channels
=
infer_channels
(
inputs
[
1
],
True
)
args
[
'channels'
]
=
channels
_clean_up_pool_args
(
args
)
out
=
AttrCvt
(
op_name
=
dimension_picker
(
'conv'
,
'_transpose'
),
transforms
=
{
'kernel_shape'
:
'kernel_size'
,
'pads'
:
(
'padding'
,
(
0
,
0
),
revert_caffe2_pad
),
'dilations'
:
(
'dilation'
,
(
1
,
1
)),
'order'
:
(
'data_layout'
,
(
"NCHW"
),
lambda
x
:
x
if
isinstance
(
x
,
str
)
else
x
.
decode
(
'UTF-8'
)),
},
excludes
=
[],
ignores
=
_caffe2_internal_args
,
custom_check
=
dimension_constraint
())(
inputs
[:
2
],
args
,
params
)
use_bias
=
len
(
inputs
)
==
3
if
use_bias
:
out
=
_op
.
nn
.
bias_add
(
out
,
inputs
[
2
])
return
out
class
Concat
(
Caffe2OpConverter
):
""" Operator converter for Concat.
"""
...
...
@@ -353,12 +386,14 @@ def _get_convert_map():
# caffe2 common operators
'Add'
:
Add
.
get_converter
(),
'Sum'
:
Sum
.
get_converter
(),
'Mul'
:
Mul
.
get_converter
(),
'Softmax'
:
Softmax
.
get_converter
(),
# nn
'AveragePool'
:
AveragePool
.
get_converter
(),
'MaxPool'
:
MaxPool
.
get_converter
(),
'Conv'
:
Conv
.
get_converter
(),
'ConvTranspose'
:
ConvTranspose
.
get_converter
(),
'Concat'
:
Concat
.
get_converter
(),
'FC'
:
FC
.
get_converter
(),
'SpatialBN'
:
SpatialBN
.
get_converter
(),
...
...
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