Skip to content

Commit 64a5a66

Browse files
manuelcandalesfacebook-github-bot
authored andcommitted
Test cpu ops with non-default memory layouts (#39)
Summary: Pull Request resolved: #39 imported-using-ghimport Test Plan: Imported from OSS Rollback Plan: Reviewed By: digantdesai Differential Revision: D80468302 Pulled By: manuelcandales fbshipit-source-id: 75e018e5e0092de8988c253d7438f3fc9692f721
1 parent 5fb77aa commit 64a5a66

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/specdb/test_specdb_cpu.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,37 @@ def test_all_ops_cpu_half(self):
3535
config = TensorConfig(device="cpu", half_precision=True)
3636
self._run_all_ops(config=config, skip_ops=skip_ops)
3737

38+
def test_all_ops_cpu_transposed(self):
39+
skip_ops = self.SKIP_OPS.copy()
40+
# Expected X.is_contiguous(memory_format) to be true, but got false.
41+
skip_ops += ["native_group_norm.default"]
42+
# _pdist_forward requires contiguous input
43+
skip_ops += ["_pdist_forward.default"]
44+
config = TensorConfig(device="cpu", transposed=True)
45+
self._run_all_ops(config=config, skip_ops=skip_ops)
46+
47+
def test_all_ops_cpu_permuted(self):
48+
skip_ops = self.SKIP_OPS.copy()
49+
# Expected X.is_contiguous(memory_format) to be true, but got false.
50+
skip_ops += ["native_group_norm.default"]
51+
# _pdist_forward requires contiguous input
52+
skip_ops += ["_pdist_forward.default"]
53+
# Unsupported memory format. Supports only ChannelsLast3d, Contiguous
54+
skip_ops += ["max_pool3d_with_indices.default"]
55+
# Unsupported memory format. Supports only ChannelsLast, Contiguous
56+
skip_ops += ["pixel_shuffle.default"]
57+
config = TensorConfig(device="cpu", permuted=True)
58+
self._run_all_ops(config=config, skip_ops=skip_ops)
59+
60+
def test_all_ops_cpu_strided(self):
61+
skip_ops = self.SKIP_OPS.copy()
62+
# Expected X.is_contiguous(memory_format) to be true, but got false.
63+
skip_ops += ["native_group_norm.default"]
64+
# _pdist_forward requires contiguous input
65+
skip_ops += ["_pdist_forward.default"]
66+
config = TensorConfig(device="cpu", strided=True)
67+
self._run_all_ops(config=config, skip_ops=skip_ops)
68+
3869

3970
if __name__ == "__main__":
4071
unittest.main()

0 commit comments

Comments
 (0)