[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6024: [Relay][TF] Make StridedSlice support dynamic input and constant attrs
kevinthesun commented on a change in pull request #6024: URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r479490473 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -1458,6 +1458,15 @@ def _impl(inputs, attr, params, mod): return ret +def _dyn(): +for d in data_shape: +if not isinstance(d, int): +return True +return False + +if _dyn(): Review comment: @lixiaoquan Can you simply raise an error here and add a TODO? We can merge this PR so that backend changes can take effect. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6024: [Relay][TF] Make StridedSlice support dynamic input and constant attrs
kevinthesun commented on a change in pull request #6024: URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r469430653 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -1458,6 +1458,15 @@ def _impl(inputs, attr, params, mod): return ret +def _dyn(): +for d in data_shape: +if not isinstance(d, int): +return True +return False + +if _dyn(): Review comment: We can use shape_of to get data shape. In this case all shape dim will be relay expression and transform mask should be able to handle them. Anyway I don't think we should silently skip it since the output can be wrong and cause latter type infer error. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6024: [Relay][TF] Make StridedSlice support dynamic input and constant attrs
kevinthesun commented on a change in pull request #6024: URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r468093208 ## File path: python/tvm/relay/frontend/tensorflow.py ## @@ -1458,6 +1458,15 @@ def _impl(inputs, attr, params, mod): return ret +def _dyn(): +for d in data_shape: +if not isinstance(d, int): +return True +return False + +if _dyn(): Review comment: Why do we need to special hand this in tf frontend and skip mask transformation? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6024: [Relay][TF] Make StridedSlice support dynamic input and constant attrs
kevinthesun commented on a change in pull request #6024: URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r465948305 ## File path: src/relay/op/tensor/transform.cc ## @@ -2146,7 +2146,18 @@ Array StridedSliceCompute(const Attrs& attrs, const Array(); CHECK(param != nullptr); - if (param->begin && param->end && param->strides) { + + bool dyn = false; + for (auto& v : out_type.as()->shape) { +if (const tir::VarNode* var_node = v.as()) { + if (var_node->name_hint == "any_dim") { +dyn = true; +break; + } +} + } + + if (param->begin && param->end && param->strides && !dyn) { Review comment: Yeah. I think it would be more complicated to fix topi. Probably we can use dynamic stridedslice compute. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [incubator-tvm] kevinthesun commented on a change in pull request #6024: [Relay][TF] Make StridedSlice support dynamic input and constant attrs
kevinthesun commented on a change in pull request #6024: URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r453119255 ## File path: src/relay/op/tensor/transform.cc ## @@ -2146,7 +2146,18 @@ Array StridedSliceCompute(const Attrs& attrs, const Array(); CHECK(param != nullptr); - if (param->begin && param->end && param->strides) { + + bool dyn = false; + for (auto& v : out_type.as()->shape) { +if (const tir::VarNode* var_node = v.as()) { + if (var_node->name_hint == "any_dim") { +dyn = true; +break; + } +} + } + + if (param->begin && param->end && param->strides && !dyn) { Review comment: I printed output_shape in topi::strided_slice and it is (0, 0) for that modified test_any case, which causes an runtime error. Maybe we can fix this bug directly in topi::strided_slice. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org