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

Dynamic ONNX Importer #6351

Merged
merged 25 commits into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
80962b7
Change onnx importer to use dynamic upsampling3d (#3)
Sep 4, 2020
b28e7e2
Refactor ONNX frontend to be dynamic
Aug 5, 2020
c1e993c
Dynamic ONNX importer: Upsampling and Pad (#2)
Aug 27, 2020
077f74c
black format
Sep 11, 2020
6ae7c02
Merge remote-tracking branch 'upstream/master' into mbrookhart/dynami…
Sep 11, 2020
2892e6a
fix batch matmul test
Sep 11, 2020
1fc3721
add dynamic strided slice to the onnx importer
Sep 11, 2020
55b4012
fix clip importer
Sep 13, 2020
8864abc
fix qnn tutorial
Sep 13, 2020
7e8efae
Merge branch 'master' into mbrookhart/dynamic_onnx
Sep 14, 2020
53f7a7b
fix bad merge, respond to review comments
Sep 14, 2020
ab33d69
add a simple dynamic model test
Sep 16, 2020
e18b0ab
Merge remote-tracking branch 'upstream/master' into mbrookhart/dynami…
Sep 16, 2020
0a1f8dc
Merge remote-tracking branch 'upstream/master' into mbrookhart/dynami…
Sep 17, 2020
db74cc3
Add dynamic-shaped autopadding to convolution and pooling ops
Sep 18, 2020
dfeed7f
fix dynamic issues in a few ops
Sep 18, 2020
5cc3621
Merge branch 'master' into mbrookhart/dynamic_onnx
Sep 18, 2020
dd6a1d7
fix pylint
Sep 18, 2020
2faf2aa
disable tests onnxrt doesn't support
Sep 21, 2020
78d3ff5
fix pytorch test
Sep 22, 2020
664a055
Merge remote-tracking branch 'upstream/master' into mbrookhart/dynami…
Sep 25, 2020
54dd8d5
respond to review comments
Sep 25, 2020
f0aa08d
Merge remote-tracking branch 'upstream/master' into mbrookhart/dynami…
Oct 1, 2020
461d6ee
Merge branch 'master' into mbrookhart/dynamic_onnx
Oct 2, 2020
24a9e22
add documentation about partially supporting dynamic shapes
Oct 2, 2020
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
11 changes: 11 additions & 0 deletions include/tvm/relay/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,17 @@ TVM_DLL Pass SimplifyInference();
*/
TVM_DLL Pass FastMath();

/*!
* \brief Find Dynamic ops and make them static
*
* Searches the graph for dynamic ops. If the dynamic inputs to those ops are constants, it replaces
* them with static ops and re-performs type inference and constant folding. The pass repeats
* itself until the graph stops changing or we run too many iterations.
*
* \return The pass.
*/
TVM_DLL Pass DynamicToStatic();

/*!
* \brief Infer the type of an expression.
*
Expand Down
11 changes: 8 additions & 3 deletions include/tvm/topi/broadcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ inline tvm::te::Tensor broadcast_to(const tvm::te::Tensor& t,
<< "\nvs\ninput: " << t;
auto bh = detail::BroadcastShape(output_shape, t->shape);
CHECK_EQ(output_shape.size(), bh.common_shape.size());
Array<PrimExpr> oshape;
for (size_t i = 0; i < output_shape.size(); ++i) {
CHECK(topi::detail::EqualCheck(output_shape[i], bh.common_shape[i]));
if (output_shape[i].as<tir::IntImmNode>() == nullptr) {
oshape.push_back(output_shape[i]);
} else {
CHECK(topi::detail::EqualCheck(output_shape[i], bh.common_shape[i]));
oshape.push_back(bh.common_shape[i]);
}
}
auto l = [&](tvm::Array<tvm::tir::Var> ovars) {
return t(detail::InputIndexFromBroadcast(ovars, t, bh.vars2, bh.all_vars));
};
return tvm::te::compute(tvm::Array<tvm::PrimExpr>(bh.common_shape.begin(), bh.common_shape.end()),
l, name, tag);
return tvm::te::compute(oshape, l, name, tag);
}

#define TOPI_DEFINE_BCAST_OP(Name, ComputeRule) \
Expand Down
Loading