Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Relay] Adding _contrib_BilinearResize2D op from mxnet #2777

Merged
merged 3 commits into from
Mar 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions python/tvm/relay/frontend/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,17 @@ def _mx_roi_align(inputs, attrs):
new_attrs["layout"] = "NCHW"
return _op.vision.roi_align(inputs[0], inputs[1], **new_attrs)

def _mx_upsampling(inputs, attrs):
scale_height = attrs.get_float("scale_height", None)
scale_width = attrs.get_float("scale_width", None)
height = attrs.get_int("height", 1)
width = attrs.get_int("width", 1)
if scale_height is not None:
height = scale_height * inputs[0].shape[2]
if scale_width is not None:
width = scale_width * inputs[0].shape[3]
size = (inputs[0].shape[0], inputs[0].shape[1], height, width)
return _op.image.resize(inputs[0], size)

def _mx_proposal(inputs, attrs):
new_attrs = {}
Expand Down Expand Up @@ -616,6 +627,7 @@ def _mx_l2_normalize(inputs, attrs):
"SoftmaxOutput" : _mx_softmax_output,
"SoftmaxActivation" : _mx_softmax_activation,
# vision
"_contrib_BilinearResize2D" : _mx_upsampling,
"_contrib_MultiBoxPrior" : _mx_multibox_prior,
"_contrib_MultiBoxDetection" : _mx_multibox_detection,
"_contrib_ROIAlign" : _mx_roi_align,
Expand Down