Skip to content

Commit a4f98ac

Browse files
committed
Remove Python side registration and tests for _clone_dim_order
1 parent b4e7f7a commit a4f98ac

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

exir/passes/dim_order_ops_registry.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@
2828
"_empty_dim_order.out(int[] size, *, int[]? dim_order=None, Tensor(a!) out) -> Tensor(a!)"
2929
)
3030

31-
lib.define(
32-
"_clone_dim_order(Tensor self, *, bool non_blocking=False, int[]? dim_order=None) -> Tensor"
33-
)
34-
35-
lib.define(
36-
"_clone_dim_order.out(Tensor self, *, bool non_blocking=False, int[]? dim_order=None, Tensor(a!) out) -> Tensor(a!)"
37-
)
38-
3931

4032
def _op_impl(target, *args, **kwargs):
4133
kwargs["memory_format"] = get_memory_format(kwargs.get("dim_order", None))
@@ -65,16 +57,6 @@ def _empty_dim_order_out_impl(*args, **kwargs):
6557
return _op_impl(torch.ops.aten.empty.out, *args, **kwargs)
6658

6759

68-
@impl(lib, "_clone_dim_order", "CompositeImplicitAutograd")
69-
def _clone_dim_order_impl(*args, **kwargs):
70-
return _op_impl(torch.ops.aten.clone.default, *args, **kwargs)
71-
72-
73-
@impl(lib, "_clone_dim_order.out", "CompositeImplicitAutograd")
74-
def _clone_dim_order_out_impl(*args, **kwargs):
75-
return _op_impl(torch.ops.aten.clone.out, *args, **kwargs)
76-
77-
7860
"""
7961
Defines a map of edge ops to the corresponding dim_order ops for quick lookup
8062
"""

exir/tests/test_memory_format_ops_pass.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -91,40 +91,6 @@ def test_op_empty_replacement_contiguous(self) -> None:
9191
),
9292
)
9393

94-
def test_op_clone_dim_order_preserves_channels_last(self):
95-
x = torch.randn(2, 3, 4, 5).to(memory_format=torch.channels_last)
96-
y = torch.ops.dim_order_ops._clone_dim_order.default(x)
97-
98-
assert y.is_contiguous(
99-
memory_format=torch.channels_last
100-
), "_clone_dim_order output is not in channels_last memory format."
101-
assert torch.allclose(x, y)
102-
103-
def test_op_clone_dim_order_to_contiguous(self):
104-
x = torch.randn(2, 3, 4, 5).to(memory_format=torch.channels_last)
105-
contiguous_dim_order = get_dim_order(torch.contiguous_format, x.dim())
106-
y = torch.ops.dim_order_ops._clone_dim_order.default(
107-
x, dim_order=contiguous_dim_order
108-
)
109-
110-
assert (
111-
y.is_contiguous()
112-
), "_clone_dim_order output is not in contiguous memory format"
113-
assert torch.allclose(x, y)
114-
115-
def test_op_clone_dim_order_out_to_channels_last(self):
116-
x = torch.randn(2, 3, 4, 5).contiguous()
117-
y = torch.empty_like(x, memory_format=torch.channels_last)
118-
channels_last_dim_order = get_dim_order(torch.channels_last, y.dim())
119-
torch.ops.dim_order_ops._clone_dim_order.out(
120-
x, dim_order=channels_last_dim_order, out=y
121-
)
122-
123-
assert y.is_contiguous(
124-
memory_format=torch.channels_last
125-
), "_clone_dim_order output is not in channels_last memory format"
126-
assert torch.allclose(x, y)
127-
12894
def test_op_dim_order_update(self) -> None:
12995
MemoryFormatOpsPassTestUtils.memory_format_test_runner(
13096
self,

0 commit comments

Comments
 (0)