Skip to content

Commit 31db5a1

Browse files
[float8 training] remove duplicate override for view (#2269)
* remove duplicate override for view * raise exception if op is already implemented
1 parent 8366465 commit 31db5a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

torchao/float8/float8_ops.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ def implements(aten_ops):
9292

9393
def decorator(func):
9494
for op in aten_ops:
95+
if op in FLOAT8_OPS_TABLE:
96+
raise RuntimeError(
97+
f"Float8 op {op} is already registered to {FLOAT8_OPS_TABLE[op].__name__}"
98+
)
9599
FLOAT8_OPS_TABLE[op] = func
96100
return func
97101

@@ -100,7 +104,6 @@ def decorator(func):
100104

101105
@implements(
102106
[
103-
aten.view.default,
104107
aten._unsafe_view.default,
105108
aten.as_strided.default,
106109
aten.clone.default,

0 commit comments

Comments
 (0)