MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _GetPyList

Method _GetPyList

tensorflow/python/framework/test_util.py:2850–2862  ·  view source on GitHub ↗

Converts `a` to a nested python list.

(self, a)

Source from the content-addressed store, hash-verified

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."""

Callers 2

_assertRaggedEqualMethod · 0.95
_assertRaggedCloseMethod · 0.95

Calls 2

evaluateMethod · 0.95
to_listMethod · 0.45

Tested by

no test coverage detected