Skip to content

Commit fc512b6

Browse files
committed
Warn on implemented but non-tested ops.
1 parent 16d06a4 commit fc512b6

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ For now, the development setup uses the CPU version of PyTorch only.
2121
* Tests are located in [`src/complex_tensor/test`](https://github.com/openteams-ai/pytorch-complex-tensor/tree/main/src/complex_tensor/test).
2222
* Testing currently needs to be expanded; currently only tests which provide `OpInfo`s in `torch.testing._internal.common_methods_invocations.op_db` are tested.
2323
* Exceptions are noted in-tree with a `TODO`.
24+
* A warning is emitted during `pytest` noting the missing ops.
2425

2526
This repository is currently WIP, which means not all ops are implemented, but many common ones are.

src/complex_tensor/test/test_ops.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,25 @@ def _get_opname_from_aten_op(aten_op):
3434
implemented_op_db = tuple(filter(lambda op: op.name in implemented_op_names, complex_op_db))
3535
force_test_op_db = tuple(filter(lambda op: op.name in force_test_names, op_db))
3636

37+
tested_op_names = {op.name for op in implemented_op_db} | {op.name for op in force_test_op_db}
38+
non_tested_ops = {
39+
op for op in COMPLEX_OPS_TABLE if _get_opname_from_aten_op(op) not in tested_op_names
40+
}
41+
42+
if len(non_tested_ops) != 0:
43+
import textwrap
44+
import warnings
45+
46+
list_missing_ops = "\n".join(
47+
sorted([op._qualified_op_name.replace("::", ".") for op in non_tested_ops])
48+
)
49+
warnings.warn(
50+
"Not all ops are tested. List of missing ops:"
51+
f"\n{textwrap.indent(list_missing_ops, ' ')}",
52+
UserWarning,
53+
stacklevel=2,
54+
)
55+
3756

3857
SKIPS = {
3958
TestDescriptor(op_name="real"): "`aten.real` does not hit `__torch_dispatch__`",

0 commit comments

Comments
 (0)