Hi, I'm trying to compile the following trivial function:

```
fn (%p0: Tensor[(3), bool], Primitive=1) -> Tensor[(3), int32] {
  where(%p0, 1 /* ty=int32 */, -1 /* ty=int32 */) /* ty=Tensor[(3), int32] */
}
```

Note that the second and third arg to `where` is a scalar. Since this is not 
supported in topi, I have updated the `topi::where` to handle this case (I used 
`x(0)` to turn a zero dim `te::Tensor` into a scalar, is this correct?):

```
  if (x->shape.size() == 0) {
    // x and y are scalar
    return compute(
        condition->shape,
        [&](const Array<Var>& indices) {
          Array<PrimExpr> condition_idx{indices[0]};
          return tvm::tir::Select(condition(condition_idx) != 0, x(0), y(0));
        },
        name, tag);
  } else if (condition->shape.size() != 1) {
     ...
  }
```

I expected this should work, but I got the following error from TE Inliner:
```
  File "/home/masa/projects/dev/tvm/src/te/schedule/operation_inline.cc", line 
54
TVMError: Check failed: args_.size() == op->indices.size() (0 vs. 1) : 
During handling of the above exception, another exception occurred:

TVMError: Check failed: args_.size() == op->indices.size() (0 vs. 1) : 
Error during compile function
-----------------------------
#[version = "0.0.5"]
fn (%p0: Tensor[(3), bool], Primitive=1) -> Tensor[(3), int32] {
  where(%p0, 1 /* ty=int32 */, -1 /* ty=int32 */) /* ty=Tensor[(3), int32] */
}
```

The error is happening at the line below:
https://github.com/apache/incubator-tvm/blob/0a1c4c2174e1c4a04ca6e40cd90cdf7c2ef1d90a/src/te/schedule/operation_inline.cc#L53

How do I solve this? I don't understand why inlining is happening for the 
trivial function above (nothing can be inlined).

@tqchen





---
[Visit Topic](https://discuss.tvm.ai/t/unclear-error-from-te-inliner/7764/1) to 
respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/ddbabe788bdfc4eb7bad02f7357fde3827c51e4226fc6ac964a3fd0bfc55c974).

Reply via email to