lixiaoquan commented on a change in pull request #6024:
URL: https://github.com/apache/incubator-tvm/pull/6024#discussion_r453138358
##
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:
topi::strided_slice requires static shape because it will get value from
each dim. Should we change this requirement or just use DynamicStrideSlice?
```
diff --git a/topi/include/topi/transform.h b/topi/include/topi/transform.h
index b5fc02ae7..329a62ce7 100644
--- a/topi/include/topi/transform.h
+++ b/topi/include/topi/transform.h
@@ -610,6 +610,7 @@ inline Tensor strided_slice(const Tensor& x, const
Array& begin, const
for (size_t i = 0; i < src_tensor_dim; ++i) {
int64_t begin_range = stride_vec[i] < 0 ? -1 : 0;
int64_t dim_i = GetConstInt(x->shape[i]);
+LOG(INFO) << dim_i; // it is -1 for modified case
int64_t end_range = stride_vec[i] < 0 ? dim_i - 1 : dim_i;
// transform negative indices to positive value, clips on the correct
range
auto index_canonicalization = [dim_i, begin_range, end_range](int64_t
index) {
@@ -635,6 +636,8 @@ inline Tensor strided_slice(const Tensor& x, const
Array& begin, const
out_shape.push_back(slice_size);
}
+// LOG(INFO) << out_shape;
+
return compute(
out_shape,
[&](const Array& indices) {
```
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