Skip to content

Commit

Permalink
adding _contrib_BilinearResize2D op from mxnet
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurawly committed Mar 12, 2019
1 parent 5e3ceaa commit 567f9f1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions python/tvm/relay/frontend/mxnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,20 @@ 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)
if scale_height == None:
height = attrs.get_int("height", 1)
scale_height = float(height) // inputs[0].shape[2]
if scale_width == None:
width = attrs.get_int("width", 1)
scale_width = float(width) // inputs[0].shape[3]
assert scale_height == scale_width
scale = scale_width
layout = 'NCHW'
method = 'BILINEAR'
return _op.nn.upsampling(inputs[0], scale=scale, layout=layout, method=method)

def _mx_proposal(inputs, attrs):
new_attrs = {}
Expand Down Expand Up @@ -616,6 +630,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

0 comments on commit 567f9f1

Please sign in to comment.