(self)
| 313 | |
| 314 | class TestGenFunctionsDeclarations(unittest.TestCase): |
| 315 | def setUp(self) -> None: |
| 316 | ( |
| 317 | self.custom_1_native_function, |
| 318 | custom_1_backend_index, |
| 319 | ) = NativeFunction.from_yaml( |
| 320 | {"func": "custom_1::op_1() -> bool", "dispatch": {"CPU": "kernel_1"}}, |
| 321 | loc=Location(__file__, 1), |
| 322 | valid_tags=set(), |
| 323 | ) |
| 324 | ( |
| 325 | self.custom_2_native_function, |
| 326 | custom_2_backend_index, |
| 327 | ) = NativeFunction.from_yaml( |
| 328 | { |
| 329 | "func": "custom_2::op_2() -> bool", |
| 330 | "dispatch": {"CPU": "kernel_2"}, |
| 331 | }, |
| 332 | loc=Location(__file__, 1), |
| 333 | valid_tags=set(), |
| 334 | ) |
| 335 | |
| 336 | backend_indices: Dict[DispatchKey, Dict[OperatorName, BackendMetadata]] = { |
| 337 | DispatchKey.CPU: {}, |
| 338 | DispatchKey.QuantizedCPU: {}, |
| 339 | } |
| 340 | BackendIndex.grow_index(backend_indices, custom_1_backend_index) |
| 341 | BackendIndex.grow_index(backend_indices, custom_2_backend_index) |
| 342 | self.static_dispatch_idx = [ |
| 343 | BackendIndex( |
| 344 | dispatch_key=k, |
| 345 | use_out_as_primary=True, |
| 346 | external=False, |
| 347 | device_guard=False, |
| 348 | index=backend_indices[k], |
| 349 | ) |
| 350 | for k in backend_indices |
| 351 | ] |
| 352 | self.kernel_index = ETKernelIndex.from_backend_indices(backend_indices) |
| 353 | |
| 354 | def test_operators_with_different_namespaces_are_grouped_correctly(self) -> None: |
| 355 | declarations = gen_functions_declarations( |
nothing calls this directly
no test coverage detected