Human readable representation of a tensor's numpy value.
(tensor, is_repr=False)
| 253 | |
| 254 | |
| 255 | def numpy_text(tensor, is_repr=False): |
| 256 | """Human readable representation of a tensor's numpy value.""" |
| 257 | if tensor.dtype.is_numpy_compatible: |
| 258 | # pylint: disable=protected-access |
| 259 | text = repr(tensor._numpy()) if is_repr else str(tensor._numpy()) |
| 260 | # pylint: enable=protected-access |
| 261 | else: |
| 262 | text = "<unprintable>" |
| 263 | if "\n" in text: |
| 264 | text = "\n" + text |
| 265 | return text |
| 266 | |
| 267 | @tf_export(v1=["enable_tensor_equality"]) |
| 268 | def enable_tensor_equality(): |