You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "jikechao (via GitHub)" <gi...@apache.org> on 2023/06/08 03:49:37 UTC
[GitHub] [tvm] jikechao opened a new pull request, #15060: [Bugfix][Relay][keras] Fix the bug about the attribute 'output_padding' in Deconv
jikechao opened a new pull request, #15060:
URL: https://github.com/apache/tvm/pull/15060
This PR fixed two bugs in Conv2DTranspose and Conv3DTranspose. Both of them are caused by lacking the parsing of the `output_padding` attribute.
In addition, corresponding test cases were added to capture the bug.
### Steps to reproduce
```
import tvm
import tvm.relay as relay
import numpy as np
from tensorflow import keras
from tensorflow.keras import layers, models
input_shape = (2, 33,33,128)
input_data = np.random.random(size=input_shape)
x = layers.Input(shape=input_shape[1:], dtype='float32')
kwargs={'filters':2,'kernel_size':[3, 3],'strides':[2, 2],'output_padding':[1, 1],}# 'data_format':"channels_last"}
# output_padding lead to this bug
layer = keras.layers.Conv2DTranspose(**kwargs)
layer.set_weights(layer.get_weights())
y = layer(x)
model = models.Model(x, y)
model.summary()
res_keras = model(input_data)
shape_dict = {'input_1': input_shape}
mod, params = relay.frontend.from_keras(model, shape_dict,layout='NHWC')
with tvm.transform.PassContext(opt_level=3):
model = relay.build_module.create_executor("graph", mod, tvm.cpu(0), 'llvm', params).evaluate()
test_x_tvm = input_data
res_tvm = model(tvm.nd.array(test_x_tvm.astype('float32'))).numpy()
np.testing.assert_allclose(res_keras, res_tvm, atol=1e-3, rtol=1e-3)
```

BTW, The Conv3DTranspose has a similar bug. The following keras layer can trigger it:
```
keras_mod.layers.Conv3DTranspose(
filters=2, kernel_size=(3, 3, 3), strides=(2, 2, 2), output_padding=(1, 1, 1)
),
```
cc @echuraev @Hzfengsy @masahi
--
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.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] tvm-bot commented on pull request #15060: [Bugfix][Relay][keras] Fix the bug about the attribute 'output_padding' in Deconv
Posted by "tvm-bot (via GitHub)" <gi...@apache.org>.
tvm-bot commented on PR #15060:
URL: https://github.com/apache/tvm/pull/15060#issuecomment-1581847994
<!---bot-comment-->
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<!--bot-comment-ccs-start-->
* cc @shingjan <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
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.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] masahi merged pull request #15060: [Bugfix][Relay][keras] Fix the bug about the attribute 'output_padding' in Deconv
Posted by "masahi (via GitHub)" <gi...@apache.org>.
masahi merged PR #15060:
URL: https://github.com/apache/tvm/pull/15060
--
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.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org