Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
a82656d4
Commit
a82656d4
authored
6 years ago
by
Pariksheet Pinjari
Committed by
Tianqi Chen
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Support imagescalar operator for onnx (#448)
parent
435201ee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nnvm/python/nnvm/frontend/onnx.py
+15
-2
15 additions, 2 deletions
nnvm/python/nnvm/frontend/onnx.py
with
15 additions
and
2 deletions
nnvm/python/nnvm/frontend/onnx.py
+
15
−
2
View file @
a82656d4
# pylint: disable=import-self, invalid-name, unused-argument
"""
ONNX: Open Neural Network Exchange frontend.
"""
from
__future__
import
absolute_import
as
_abs
import
numpy
as
np
import
tvm
from
..
import
symbol
as
_sym
from
..
import
graph
as
_graph
from
..compiler
import
graph_util
from
.common
import
get_nnvm_op
,
Renamer
,
AttrConverter
as
AttrCvt
from
.common
import
get_nnvm_op
,
Renamer
,
SymbolTable
,
AttrConverter
as
AttrCvt
__all__
=
[
'
from_onnx
'
]
...
...
@@ -322,6 +323,18 @@ class ThresholdedRelu(OnnxOpConverter):
return
_sym
.
relu
(
inputs
[
0
]
-
alpha
)
class
ImageScaler
(
OnnxOpConverter
):
@classmethod
def
_impl_v1
(
cls
,
inputs
,
attr
,
params
):
channelScale
=
attr
[
'
scale
'
]
bias_attr
=
attr
[
'
bias
'
]
bias
=
SymbolTable
().
new_const
(
np
.
array
(
bias_attr
).
reshape
([
3
,
1
,
1
]))
scaledChannel
=
_sym
.
__mul_scalar__
(
inputs
[
0
],
scalar
=
channelScale
)
ret
=
_sym
.
broadcast_add
(
scaledChannel
,
bias
)
return
ret
def
_revert_caffe2_pad
(
attr
):
"""
Caffe2 require two times the normal padding.
"""
if
len
(
attr
)
==
4
:
...
...
@@ -410,7 +423,7 @@ def _get_convert_map(opset):
'
Scale
'
:
Scale
.
get_converter
(
opset
),
# 'GRUUnit'
# 'ATen'
#
'ImageScaler'
'
ImageScaler
'
:
ImageScaler
.
get_converter
(
opset
),
# 'MeanVarianceNormalization'
# 'Crop'
# 'Embedding'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment