Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
116 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
from __future__ import unicode_literals | ||
|
||
import numpy as np | ||
import itertools | ||
|
||
import onnx | ||
from ..base import Base | ||
from . import expect | ||
|
||
|
||
class Transpose(Base): | ||
|
||
@staticmethod | ||
def export_default(): | ||
shape = (2, 3, 4) | ||
data = np.random.random_sample(shape).astype(np.float32) | ||
|
||
node = onnx.helper.make_node( | ||
'Transpose', | ||
inputs=['data'], | ||
outputs=['transposed'] | ||
) | ||
|
||
transposed = np.transpose(data) | ||
expect(node, inputs=[data], outputs=[transposed], | ||
name='test_transpose_default') | ||
|
||
@staticmethod | ||
def export_all_permutations(): | ||
shape = (2,3,4) | ||
data = np.random.random_sample(shape).astype(np.float32) | ||
permutations = list(itertools.permutations(np.arange(len(shape)))) | ||
|
||
for i in range(len(permutations)): | ||
node = onnx.helper.make_node( | ||
'Transpose', | ||
inputs=['data'], | ||
outputs=['transposed'], | ||
perm=permutations[i] | ||
) | ||
transposed = np.transpose(data, permutations[i]) | ||
expect(node, inputs=[data], outputs=[transposed], | ||
name='test_transpose_all_permutations_' + str(i)) |
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_0/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_0/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_0/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_1/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_1/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_1/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?H��>��v?�7?QY%?rR�>�N?n�>~�J?w}?<Kd?�e?^k?��<��z?��l?�&U?��L?Z{�=H5G?G�>�p�=�^?��G? | ||
|
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_2/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_2/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_2/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?�7?�N?w}?^k?��l?Z{�=�p�=H��>QY%?n�><Kd?��<�&U?H5G?�^?��v?rR�>~�J?�e?��z?��L?G�>��G? | ||
|
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_3/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_3/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_3/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?^k?�7?��l?�N?Z{�=w}?�p�=H��>��<QY%?�&U?n�>H5G?<Kd?�^?��v?��z?rR�>��L?~�J?G�>�e?��G? | ||
|
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_4/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_4/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_4/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?H��>��v?^k?��<��z?�7?QY%?rR�>��l?�&U?��L?�N?n�>~�J?Z{�=H5G?G�>w}?<Kd?�e?�p�=�^?��G? | ||
|
1 change: 1 addition & 0 deletions
1
onnx/backend/test/data/node/test_transpose_all_permutations_5/input_0.pb
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
Binary file added
BIN
+46 Bytes
onnx/backend/test/data/node/test_transpose_all_permutations_5/node.pb
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_all_permutations_5/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?^k?H��>��<��v?��z?�7?��l?QY%?�&U?rR�>��L?�N?Z{�=n�>H5G?~�J?G�>w}?�p�=<Kd?�^?�e?��G? | ||
|
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 @@ | ||
BdataJ`?�7?�N?w}?H��>QY%?n�><Kd?��v?rR�>~�J?�e?^k?��l?Z{�=�p�=��<�&U?H5G?�^?��z?��L?G�>��G? | ||
|
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,3 @@ | ||
|
||
data | ||
transposed" Transpose |
2 changes: 2 additions & 0 deletions
2
onnx/backend/test/data/node/test_transpose_default/output_0.pb
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,2 @@ | ||
B | ||
transposedJ`?^k?H��>��<��v?��z?�7?��l?QY%?�&U?rR�>��L?�N?Z{�=n�>H5G?~�J?G�>w}?�p�=<Kd?�^?�e?��G? | ||
|