-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add MaxUnpool op to ONNX. * Fixed bug in shape inference for MaxUnpool. * Removing whitespaces to fix CI failure. * Updating stale files. * Clarified doc about row-storage for input indices.
- Loading branch information
1 parent
c4f7043
commit 96758c9
Showing
15 changed files
with
515 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
import numpy as np # type: ignore | ||
|
||
import onnx | ||
from ..base import Base | ||
from . import expect | ||
|
||
|
||
class MaxUnpool(Base): | ||
|
||
@staticmethod | ||
def export_without_output_shape(): # type: () -> None | ||
node = onnx.helper.make_node( | ||
'MaxUnpool', | ||
inputs=['xT', 'xI'], | ||
outputs=['y'], | ||
kernel_shape=[2, 2], | ||
strides=[2, 2] | ||
) | ||
xT = np.array([[[[1, 2], | ||
[3, 4]]]], dtype=np.float32) | ||
xI = np.array([[[[5, 7], | ||
[13, 15]]]], dtype=np.int64) | ||
y = np.array([[[[0, 0, 0, 0], | ||
[0, 1, 0, 2], | ||
[0, 0, 0, 0], | ||
[0, 3, 0, 4]]]], dtype=np.float32) | ||
expect(node, inputs=[xT, xI], outputs=[y], name='test_maxunpool_export_without_output_shape') | ||
|
||
@staticmethod | ||
def export_with_output_shape(): # type: () -> None | ||
node = onnx.helper.make_node( | ||
'MaxUnpool', | ||
inputs=['xT', 'xI', 'output_shape'], | ||
outputs=['y'], | ||
kernel_shape=[2, 2], | ||
strides=[2, 2] | ||
) | ||
xT = np.array([[[[5, 6], | ||
[7, 8]]]], dtype=np.float32) | ||
xI = np.array([[[[5, 7], | ||
[13, 15]]]], dtype=np.int64) | ||
output_shape = np.array((1, 1, 5, 5), dtype=np.int64) | ||
y = np.array([[[[0, 0, 0, 0, 0], | ||
[0, 5, 0, 6, 0], | ||
[0, 0, 0, 0, 0], | ||
[0, 7, 0, 8, 0], | ||
[0, 0, 0, 0, 0]]]], dtype=np.float32) | ||
expect(node, inputs=[xT, xI, output_shape], outputs=[y], name='test_maxunpool_export_with_output_shape') |
29 changes: 29 additions & 0 deletions
29
onnx/backend/test/data/node/test_maxunpool_export_with_output_shape/model.onnx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
backend-test:� | ||
M | ||
xT | ||
xI | ||
output_shapey" MaxUnpool* | ||
kernel_shape@@�* | ||
strides@@�'test_maxunpool_export_with_output_shapeZ | ||
xT | ||
Z | ||
xI | ||
Z | ||
output_shape | ||
|
||
b | ||
y | ||
B |
Binary file added
BIN
+32 Bytes
...backend/test/data/node/test_maxunpool_export_with_output_shape/test_data_set_0/input_0.pb
Binary file not shown.
Binary file added
BIN
+48 Bytes
...backend/test/data/node/test_maxunpool_export_with_output_shape/test_data_set_0/input_1.pb
Binary file not shown.
Binary file added
BIN
+52 Bytes
...backend/test/data/node/test_maxunpool_export_with_output_shape/test_data_set_0/input_2.pb
Binary file not shown.
Binary file added
BIN
+115 Bytes
...ackend/test/data/node/test_maxunpool_export_with_output_shape/test_data_set_0/output_0.pb
Binary file not shown.
24 changes: 24 additions & 0 deletions
24
onnx/backend/test/data/node/test_maxunpool_export_without_output_shape/model.onnx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
backend-test:� | ||
? | ||
xT | ||
xIy" MaxUnpool* | ||
kernel_shape@@�* | ||
strides@@�*test_maxunpool_export_without_output_shapeZ | ||
xT | ||
Z | ||
xI | ||
b | ||
y | ||
B |
Binary file added
BIN
+32 Bytes
...kend/test/data/node/test_maxunpool_export_without_output_shape/test_data_set_0/input_0.pb
Binary file not shown.
Binary file added
BIN
+48 Bytes
...kend/test/data/node/test_maxunpool_export_without_output_shape/test_data_set_0/input_1.pb
Binary file not shown.
Binary file added
BIN
+79 Bytes
...end/test/data/node/test_maxunpool_export_without_output_shape/test_data_set_0/output_0.pb
Binary file not shown.
Oops, something went wrong.