Converts `a` to a nested python list.
(self, a)
| 2848 | "Devices %s and %s are not equal. %s" % (device1, device2, msg)) |
| 2849 | |
| 2850 | def _GetPyList(self, a): |
| 2851 | """Converts `a` to a nested python list.""" |
| 2852 | if isinstance(a, ragged_tensor.RaggedTensor): |
| 2853 | return self.evaluate(a).to_list() |
| 2854 | elif isinstance(a, ops.Tensor): |
| 2855 | a = self.evaluate(a) |
| 2856 | return a.tolist() if isinstance(a, np.ndarray) else a |
| 2857 | elif isinstance(a, np.ndarray): |
| 2858 | return a.tolist() |
| 2859 | elif isinstance(a, ragged_tensor_value.RaggedTensorValue): |
| 2860 | return a.to_list() |
| 2861 | else: |
| 2862 | return np.array(a).tolist() |
| 2863 | |
| 2864 | def _assertRaggedEqual(self, a, b, msg): |
| 2865 | """Asserts that two ragged tensors are equal.""" |
no test coverage detected