Skip to content

Commit

Permalink
add dilation case for ConvTranspose op (onnx#1797)
Browse files Browse the repository at this point in the history
* add dilation case for ConvTranspose op

* add comment

* upload test data

* upload changed docs

* fix check err

* add comment

* add space

* revert unintended change

* revert unintended change
  • Loading branch information
RandyShuai authored and houseroad committed Feb 11, 2019
1 parent 9738a08 commit 781f9d3
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 1 deletion.
24 changes: 24 additions & 0 deletions docs/Operators.md
Expand Up @@ -2687,6 +2687,30 @@ expect(node, inputs=[x, W], outputs=[y],
</details>


<details>
<summary>convtranspose_dilations</summary>

```python
x = np.array([[[[3., 8., 1.], # (1, 1, 3, 3)
[9., 5., 7.],
[3., 2., 6.]]]]).astype(np.float32)
W = np.array([[[[7., 2.], # (1, 1, 2, 2)
[1., 9.]]]]).astype(np.float32)

node = onnx.helper.make_node("ConvTranspose", ["X", "W"], ["Y"], dilations=[2, 2])

y = np.array([[[[21., 56., 13., 16., 2.], # [1, 1, 5, 5]
[63., 35., 67., 10., 14.],
[24., 22., 76., 76., 21.],
[9., 5., 88., 45., 63.],
[3., 2., 33., 18., 54.]]]]).astype(np.float32)

expect(node, inputs=[x, W], outputs=[y], name='test_convtranspose_dilations')
```

</details>


<details>
<summary>convtranspose_pads</summary>

Expand Down
24 changes: 23 additions & 1 deletion docs/TestCoverage.md
Expand Up @@ -1345,7 +1345,7 @@ expect(node_with_asymmetric_padding, inputs=[x, W], outputs=[y_with_asymmetric_p


### ConvTranspose
There are 5 test cases, listed as following:
There are 6 test cases, listed as following:
<details>
<summary>convtranspose</summary>

Expand Down Expand Up @@ -1568,6 +1568,28 @@ expect(node, inputs=[x, W], outputs=[y],
name='test_convtranspose_kernel_shape')
```

</details>
<details>
<summary>convtranspose_dilations</summary>

```python
x = np.array([[[[3., 8., 1.], # (1, 1, 3, 3)
[9., 5., 7.],
[3., 2., 6.]]]]).astype(np.float32)
W = np.array([[[[7., 2.], # (1, 1, 2, 2)
[1., 9.]]]]).astype(np.float32)

node = onnx.helper.make_node("ConvTranspose", ["X", "W"], ["Y"], dilations=[2, 2])

y = np.array([[[[21., 56., 13., 16., 2.], # [1, 1, 5, 5]
[63., 35., 67., 10., 14.],
[24., 22., 76., 76., 21.],
[9., 5., 88., 45., 63.],
[3., 2., 33., 18., 54.]]]]).astype(np.float32)

expect(node, inputs=[x, W], outputs=[y], name='test_convtranspose_dilations')
```

</details>
<details>
<summary>convtranspose_pads</summary>
Expand Down
18 changes: 18 additions & 0 deletions onnx/backend/test/case/node/convtranspose.py
Expand Up @@ -253,3 +253,21 @@ def export_convtranspose_pads(): # type: () -> None
[13., 7., 15.]]]]).astype(np.float32)

expect(node, inputs=[x, W], outputs=[y], name='test_convtranspose_pads')

@staticmethod
def export_convtranspose_dilations(): # type: () -> None
x = np.array([[[[3., 8., 1.], # (1, 1, 3, 3)
[9., 5., 7.],
[3., 2., 6.]]]]).astype(np.float32)
W = np.array([[[[7., 2.], # (1, 1, 2, 2)
[1., 9.]]]]).astype(np.float32)

node = onnx.helper.make_node("ConvTranspose", ["X", "W"], ["Y"], dilations=[2, 2])

y = np.array([[[[21., 56., 13., 16., 2.], # [1, 1, 5, 5]
[63., 35., 67., 10., 14.],
[24., 22., 76., 76., 21.],
[9., 5., 88., 45., 63.],
[3., 2., 33., 18., 54.]]]]).astype(np.float32)

expect(node, inputs=[x, W], outputs=[y], name='test_convtranspose_dilations')
@@ -0,0 +1,23 @@
 backend-test:�
,
X
WY"ConvTranspose*
dilations@@�test_convtranspose_dilationsZ
X




Z
W




b
Y




B
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 781f9d3

Please sign in to comment.