Skip to content

Commit

Permalink
fix test regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrookhart committed Feb 10, 2021
1 parent 3f0a308 commit 6e7b71c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions python/tvm/relay/frontend/onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,6 @@ def _impl_v10(cls, inputs, attr, params):

scale = inputs[1]
size = _op.cast(shape_of(inputs[0]), infer_type(scale).checked_type.dtype) * scale
size = _op.cast(size, "int64")
layout = "NCHW" # ONNX assumes NCHW layout
out_size = fold_constant(_op.strided_slice(size, [2], [4]))
return _op.image.resize(inputs[0], out_size, layout, method, "asymmetric")
Expand All @@ -1999,7 +1998,6 @@ def _impl_v11(cls, inputs, attr, params):
else:
assert len(scale_shape) != 0, "One of scale or size should be passed."
size = _op.cast(shape_of(inputs[0]), infer_type(scale).checked_type.dtype) * scale
size = _op.cast(size, "int64")

coord_trans = attr.get("coordinate_transformation_mode")
if coord_trans in [b"pytorch_half_pixel", b"half_pixel"]:
Expand Down
2 changes: 1 addition & 1 deletion python/tvm/relay/op/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def resize(
The resized result.
"""
if isinstance(size, Constant):
size = list(size.data.asnumpy())
size = list(size.data.asnumpy().astype("int32"))
if isinstance(size, Expr):
return _dyn_make.resize(
data, size, layout, method, coordinate_transformation_mode, out_dtype
Expand Down
2 changes: 1 addition & 1 deletion tests/python/relay/test_op_grad_level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_zeros_ones_grad_const_ints():

def test_zeros_ones_grad_const_expr():
# when shape is static (i.e. not an input), there is no gradient at all
shape_const = relay.const(np.array([2, 3, 4]), dtype="int32")
shape_const = relay.const(np.array([2, 3, 4]), dtype="int32") * relay.const(1, dtype="int32")
static_ty = relay.TensorType([2, 3, 4], dtype="float32")
dyn_ty = relay.TensorType([relay.Any(), relay.Any(), relay.Any()], dtype="float32")
expected_ty_static = relay.TupleType([static_ty, relay.TupleType([])])
Expand Down

0 comments on commit 6e7b71c

Please sign in to comment.