Updates all e2e tests to use TracedModuleTestCase (#2736)
Follow up to #2660.
- Removes old infra:
- `CompiledModuleTestCase`
- `_VirtualModuleInstance`
- `_VirtualModuleFunctionWrapper`
- `_collect_disagreements_recursively`
- `_collect_disagreements`
- `_make_multi_result_class` and `MultiResults`
- `_instantiate_backends`
- `explicit_backend_test.py`
- Updates all tests in `integrations/tensorflow/e2e/` to use the `TracedModuleTestCase`.
- Updates `iree_e2e_test_suite` and `iree_vision_test_suite` to use the new explicit `--reference_backend` flag.
- Adds data generation helpers to `tf_utils`:
- `uniform(shape, dtype=np.float32)` reduces verbosity of getting random `np.float32` data.
- `ndarange(shape, dtype=np.float32)` reduces verbosity of generating high rank `np.arange` data.
- Updates `tf.tensor --> np.array` conversion in `TfCompiledModule` to handle the following case:
```python
a = np.array(31. dtype=np.float32)
b = tf.convert_to_tensor(a)
c = b.numpy()
type(a) != type(c) # np.array != np.float32
```
diff --git a/integrations/tensorflow/e2e/resource_ops_test.py b/integrations/tensorflow/e2e/resource_ops_test.py
index 8daa6cf..dd5ad6d 100644
--- a/integrations/tensorflow/e2e/resource_ops_test.py
+++ b/integrations/tensorflow/e2e/resource_ops_test.py
@@ -29,11 +29,14 @@
@tf_test_utils.compile_module(ResourcesOpsModule)
-class ResourcesOpsTest(tf_test_utils.CompiledModuleTestCase):
+class ResourcesOpsTest(tf_test_utils.TracedModuleTestCase):
def test_add_assign(self):
- result = self.get_module().add_assign(np.array(9., dtype=np.float32))
- result.assert_all_close()
+
+ def add_assign(module):
+ module.add_assign(np.array(9., dtype=np.float32))
+
+ self.compare_backends(add_assign)
if __name__ == "__main__":