-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
3e5989f
commit 41c130d
Showing
8 changed files
with
115 additions
and
71 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
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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
from op_tools.save_op_args import serialize_args_to_dict | ||
from op_tools.pretty_print import pretty_print_op_args | ||
from op_tools.utils import compare_result | ||
from op_tools.pretty_print import dict_data_list_to_table, packect_data_to_dict_list | ||
import torch | ||
import ditorch | ||
|
||
x = torch.randn(3, 4, device="cuda") | ||
y = torch.randn(3, 4, 7, 8, device="cpu") | ||
|
||
pretty_print_op_args( | ||
op_name="torch.add", | ||
inputs_dict=serialize_args_to_dict(x, x, x), | ||
outputs_dict=serialize_args_to_dict(x), | ||
) | ||
pretty_print_op_args( | ||
op_name="torch.stack", | ||
inputs_dict=serialize_args_to_dict([x, x, x], dim=1), | ||
outputs_dict=serialize_args_to_dict(x), | ||
) | ||
import unittest | ||
|
||
|
||
class TestPrettyPrint(unittest.TestCase): | ||
def test_pretty_print(self): | ||
x = torch.randn(3, 4, device="cuda") | ||
y = torch.randn(3, 4, 7, 8, device="cpu") | ||
|
||
data_list1 = packect_data_to_dict_list("torch.add", serialize_args_to_dict(x, x)) | ||
data_list2 = packect_data_to_dict_list("torch.stack", serialize_args_to_dict([y, y, y], dim=1)) | ||
|
||
data_list = data_list1 + data_list2 | ||
|
||
self.assertTrue(len(data_list) == 6) | ||
|
||
table = dict_data_list_to_table(data_list) | ||
|
||
print(table) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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
Oops, something went wrong.