You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Steve via TVM Discuss <no...@discuss.tvm.ai> on 2020/05/08 06:56:18 UTC

[TVM Discuss] [Questions] Relay Level Tiling of Conv2d or any operator


Dear All,

I am wondering how can I write a Relay pass that tiles conv2d by the output channels (data partitioning)  in Relay graph level? 

For example, let us assume that I have some relay program like below, and I want to able to traverse the relay graph that contains this conv2d, and able to re-write it to one below **with two conv2d**? 

```
kernel_size = 3
# N, C, H, W
input_shape = (1, 4, 10, 10)

# OIHW 
out_channels = 6
weight_shape = (**out_channels**, 4, kernel_size, kernel_size)

conv2d  = relay.nn.conv2d(
input,
weight,
channels = **out_channels **,
kernel_size = 3
)
```

Translate this into 

```
conv2d_1  = relay.nn.conv2d(
input,
weight,
channels = **out_channels/2 **,
kernel_size = 3
)

conv2d_2  = relay.nn.conv2d(
input,
weight,
channels = **out_channels/2 **,
kernel_size = 3
)

conv2d_final = tvm.relay.concatenate (conv2d_1, conv2d_2 )

```





---
[Visit Topic](https://discuss.tvm.ai/t/relay-level-tiling-of-conv2d-or-any-operator/6621/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/7af26b012424c3213cc80f49e2ae4fee054f4566e0d340450cc865d7218a03fb).

[TVM Discuss] [Questions] Relay Level Tiling of Conv2d or any operator

Posted by Jared Roesch via TVM Discuss <no...@discuss.tvm.ai>.

You can write a small pass in Python to partition the program in the way that you would like. For example this below pass splits the inputs, and then adds, and concatenates them. You can employ a similar technique to do the partitioning that you want. 

https://gist.github.com/jroesch/a110f8eab27ba2bfb1b433fed2b13c9c





---
[Visit Topic](https://discuss.tvm.ai/t/relay-level-tiling-of-conv2d-or-any-operator/6621/2) 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/2daf9052ccce0d9fac8ab2a4e4b46f6ca34731cb5e0ff5f40bcda25ddd721b13).