MCPcopy Create free account
hub / github.com/pytorch/executorch / test_operator_set

Function test_operator_set

backends/vulkan/test/utils.py:943–979  ·  view source on GitHub ↗

Test if a set of operators works correctly when combined with known good operators.

(ops_to_test: List, known_good_ops: List)

Source from the content-addressed store, hash-verified

941 test_count = 0
942
943 def test_operator_set(ops_to_test: List, known_good_ops: List) -> bool:
944 """Test if a set of operators works correctly when combined with known good operators."""
945 nonlocal test_count
946 test_count += 1
947
948 test_allowlist = known_good_ops + ops_to_test
949 logger.info(
950 f"Test {test_count}: Testing {len(ops_to_test)} operators with {len(known_good_ops)} known good"
951 )
952
953 try:
954 success = lower_module_and_test_output(
955 model=model,
956 sample_inputs=sample_inputs,
957 atol=atol,
958 rtol=rtol,
959 dynamic_shapes=dynamic_shapes,
960 test_inputs=test_inputs,
961 first_output_only=first_output_only,
962 operator_allowlist=test_allowlist,
963 )
964 logger.info(f" {'✓ PASS' if success else '✗ FAIL'}")
965
966 # Log known good ops
967 logger.info(" Known good:")
968 for op in known_good_ops:
969 logger.info(f" * {op.name()}")
970
971 # Log tested ops
972 logger.info(" Tested ops:")
973 for op in ops_to_test:
974 logger.info(f" * {op.name()}")
975
976 return success
977 except Exception as e:
978 logger.info(f" ! Error: {e}")
979 return False
980
981 def find_bad_operators(
982 ops_to_test: List, known_good_ops: List

Callers 1

find_bad_operatorsFunction · 0.85

Calls 3

infoMethod · 0.80
nameMethod · 0.80

Tested by

no test coverage detected