[Apache TVM Discuss] [Questions] Changing return of relay.Function or IRModule?

2021-03-04 Thread jmatai via Apache TVM Discuss
Awesome! Thanks and I believe it works. [quote="mbrookhart, post:8, topic:9307"] You were storing the add pre-mutation. [/quote] --- [Visit Topic](https://discuss.tvm.apache.org/t/changing-return-of-relay-function-or-irmodule/9307/9) to respond. You are receiving this because you enabl

[Apache TVM Discuss] [Questions] Changing return of relay.Function or IRModule?

2021-03-04 Thread jmatai via Apache TVM Discuss
Ohh, I thought my bad! Thanks a lot. There is only a slight problem. This is what I get. It adds an additional statement into relay IR ( %3 = add(%x1, %y1);) and returns the result. ``` fn (%x1: Tensor[(1, 1, 1, 20), float32], %y1: Tensor[(1, 1, 1, 20), float32]) { %0 = add(%x1, %y1); %

[Apache TVM Discuss] [Questions] Changing return of relay.Function or IRModule?

2021-03-04 Thread jmatai via Apache TVM Discuss
Thanks, @mbrookhart. I think that is promising. However, now my "new_body" becomes "None" which causes a (surely) error. This is caused by my version over-written visit_call() function as follows: I was hoping to save the "result" of add operator to self.return_values with the following cod

[Apache TVM Discuss] [Questions] Changing return of relay.Function or IRModule?

2021-03-04 Thread jmatai via Apache TVM Discuss
Hi @mbrookhart Could you please elaborate how I wrap multiple outputs for relay.Fuction? This is my attempt to add an additional "return" to a relay function. In the visit_function(), I tried to reconstruct the function, but the relay.Function prototype does not have any place that I can wr

[Apache TVM Discuss] [Questions] Changing return of relay.Function or IRModule?

2021-03-04 Thread jmatai via Apache TVM Discuss
Hi All, Is there a way to return intermediate values inside an IRModule as an output? Here is an example. How can I return %1 or %0 as an output? from the IRModule or form relay.Function? @mbrookhart any suggestions? ``` def @main(%x1: Tensor[(1, 1, 1, 20), float32], %y1: Tensor[(1, 1,

[Apache TVM Discuss] [Questions] Importing relay IRModule from text file?

2021-03-03 Thread jmatai via Apache TVM Discuss
Hi All, Is it possible to import relay IRModule from a text file? Assume, I have a text file named "a.txt" which contains the following. Can I import it to IRModule? ``` def @main(%x1: Tensor[(1, 1, 1, 20), float32], %y1: Tensor[(1, 1, 1, 20), float32]) { %0 = add(%x1, %y1); %1 = subt

[Apache TVM Discuss] [Questions] Rewrite all inputs to Relay IR (convert 1d to 4D)

2021-03-02 Thread jmatai via Apache TVM Discuss
Hi @mbrookhart, thanks. I got it working by replacing the last line with func = relay.Function(analysis.free_vars(new_body), new_body) Not sure, why the one that I originally used not working. But this solves the problem. Thanks. [quote="mbrookhart, post:5, topic:9254"] I think the issue is

[Apache TVM Discuss] [Questions] How to extract Relay expressions following If statement

2021-03-02 Thread jmatai via Apache TVM Discuss
Hi @mbrookhart, I have made some attempts as you suggested (doing reverse topological order and getting the part after IF as you suggested). Here is my understanding of your suggestions which I also agree with. Please let me know if I got them wrong. Here are the steps that I assumed that I s

[Apache TVM Discuss] [Questions] How to extract a relay function when doing partitioning with relay pattern?

2021-02-08 Thread jmatai via Apache TVM Discuss
Hi @comaniac , @masahi and @jroesch, Any suggestions for the above problem? How can I extract the partitioned relay function from relay IRModule? --- [Visit Topic](https://discuss.tvm.apache.org/t/how-to-extract-a-relay-function-when-doing-partitioning-with-relay-pattern/9065/2) to res

[Apache TVM Discuss] [Questions] Understanding TVM/Relay's PartitionGraph()(mod) function

2020-11-10 Thread jmatai via Apache TVM Discuss
Hi All, Hi @comaniac, I want to follow up with my above post. I removed the IF statement, and now it works. Is that mean there is some MergeCompilerRegions does not fully support IF yet. This is the code that works. ``` # this is test case for graph type 1 print("Graph type 1")

[Apache TVM Discuss] [Questions] Understanding TVM/Relay's PartitionGraph()(mod) function

2020-10-27 Thread jmatai via Apache TVM Discuss
[quote="comaniac, post:7, topic:8290"] `MergeCompilerRegion` [/quote] Thank @comaniac. I have tried to use MergeCompilerRegion, and it is giving me an error with the following code. The following code works (I commented out MergeCompilerRegion), and it produces output with UNMERGED @special_

[Apache TVM Discuss] [Questions] Understanding TVM/Relay's PartitionGraph()(mod) function

2020-10-27 Thread jmatai via Apache TVM Discuss
Hi All, Thanks @masahi, @comaniac and @matt-arm. It worked now. That being said, I'd like to confirm 1) if I understand the functionality of PartitionGraph() function in the relay, 2) I'd like to understand if ParitioGraph() can be used for my specific use case. Here is my understanding of

[Apache TVM Discuss] [Questions] Understanding TVM/Relay's PartitionGraph()(mod) function

2020-10-26 Thread jmatai via Apache TVM Discuss
Hi All, I am working on trying to understand TVM/Relay’s graph partitioning functionalities. Specifically, I have created the following simple example, and I am getting the error as follows. I understand that PartitionGraph() function assumes the graph is annotated with target with Annotat