Skip to content

Commit

Permalink
Update Docker CI (apache#8193)
Browse files Browse the repository at this point in the history
* add failing onnx tets

* point jenkins at new docker

* support convtranspose opset 11 autopadding

* Don't force output shape for conv transpose tests, add 1D and 3D cases

* disable test until CI update complete

* try updating docker images again

* skip a test until update complete

* next try at docker images

* manage TF memory use in TF1 tests

* support explicit padding for NCHW TF padding test

* Update to tagged tlcpack images

Thanks, Andrew!

Co-authored-by: Andrew Reusch <areusch@gmail.com>

Co-authored-by: Andrew Reusch <areusch@gmail.com>
  • Loading branch information
2 people authored and ylc committed Jan 13, 2022
1 parent 89c9762 commit 95234e9
Show file tree
Hide file tree
Showing 4 changed files with 340 additions and 52 deletions.
8 changes: 4 additions & 4 deletions Jenkinsfile
Expand Up @@ -45,12 +45,12 @@

// NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. -->
ci_lint = "tlcpack/ci-lint:v0.66"
ci_gpu = "tlcpack/ci-gpu:v0.75"
ci_cpu = "tlcpack/ci-cpu:v0.74"
ci_gpu = "tlcpack/ci-gpu:v0.76"
ci_cpu = "tlcpack/ci-cpu:v0.75"
ci_wasm = "tlcpack/ci-wasm:v0.71"
ci_i386 = "tlcpack/ci-i386:v0.73"
ci_qemu = "tlcpack/ci-qemu:v0.05"
ci_arm = "tlcpack/ci-arm:v0.05"
ci_qemu = "tlcpack/ci-qemu:v0.06"
ci_arm = "tlcpack/ci-arm:v0.06"
// <--- End of regex-scanned config.

// tvm libraries
Expand Down
64 changes: 64 additions & 0 deletions python/tvm/relay/frontend/onnx.py
Expand Up @@ -585,6 +585,70 @@ def _impl_v1(cls, inputs, attr, params):
out = _op.nn.bias_add(out, inputs[2])
return out

@classmethod
def _impl_v11(cls, inputs, attr, params):
# get number of channels
out_type = infer_type(inputs[1])
out_shapes = [get_const_tuple(out_type.checked_type.shape)]
channels = out_shapes[0][1]
attr["channels"] = channels
groups = attr.get("group", 1)

if "kernel_shape" not in attr:
attr["kernel_shape"] = out_shapes[0][2:]

attr["groups"] = groups
# infer pads for auto_pad
data = inputs[0]
input_shape = infer_shape(data)
ndim = len(input_shape)
if "auto_pad" in attr:
attr["auto_pad"] = attr["auto_pad"].decode("utf-8")
if attr["auto_pad"] in ("SAME_UPPER", "SAME_LOWER"):
# Warning: Convolution does not yet support dynamic shapes,
# one will need to run dynamic_to_static on this model after import
kernel_shape = attr["kernel_shape"]
kndim = len(kernel_shape)
dilations = attr.get("dilations", [1] * kndim)
output_padding = attr.get("output_padding", [0] * kndim)
strides = attr["strides"]
total_pad = [0] * kndim
for i in range(kndim):
total_pad[i] = (
output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - strides[i]
)
left = [p // 2 for p in total_pad]
right = [total_pad[i] - left[i] for i in range(kndim)]
if "LOWER" in attr["auto_pad"]:
pad = left + right
else:
pad = right + left
attr["pads"] = pad
elif attr["auto_pad"] == "VALID":
attr["pads"] = tuple([0 for i in range(ndim - 2)])
elif attr["auto_pad"] == "NOTSET":
pass
else:
msg = 'Value {} in attribute "auto_pad" of operator Conv is invalid.'
raise tvm.error.OpAttributeInvalid(msg.format(attr["auto_pad"]))
attr.pop("auto_pad")

out = AttrCvt(
op_name=dimension_picker("conv", "_transpose"),
transforms={
"kernel_shape": "kernel_size",
"dilations": ("dilation", 1),
"pads": ("padding", 0),
"group": ("groups", 1),
},
disables=["output_shape"],
custom_check=dimension_constraint(),
)([data, inputs[1]], attr, params)
use_bias = len(inputs) == 3
if use_bias:
out = _op.nn.bias_add(out, inputs[2])
return out


class GlobalAveragePool(OnnxOpConverter):
"""Operator converter for GlobalAveragePool"""
Expand Down

0 comments on commit 95234e9

Please sign in to comment.