I'm building some functions in Relay, which have reshape stages for some 
tensors.  However, there are special cases where from a memory layout 
perspective the reshape operation is the identity.

E.g. I might have a volume **A** of shape `[a, b, c]`, but I have an operation 
which reshapes it into **B***, of shape `[a, b, c//2, c//2]`.

In 1D memory **A** might look like: `[1, 2, 3, 4, 5, ....]`.

For most cases of the reshape, it would return something different, e.g. **B** 
= `[1, 2, 5, 6, 3, 4, ...]`.  However, in other cases **B** will still be 
identical: `[1, 2, 3, 4, 5, ....]`.

I haven't figured out a way to ensure that in this case the reshape is done 
in-place, i.e. there is no copy of **A** made.  I could always skip the 
operation, however I need the indexing of **B** later in the algorithm.

Is there a way I can ensure this happens?  Would it be a schedule problem?  Or 
is it something I can specify elsewhere?  I still see the reshape in the TVM IR.





---
[Visit Topic](https://discuss.tvm.ai/t/reshape-in-place-using-relay/6856/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/83ca5954ca47792148f7f23996d71c6db1cf9cce6236c8997f7d38c1334c4c20).

Reply via email to