MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _is_tensorflow_array

Function _is_tensorflow_array

lib/matplotlib/cbook.py:2478–2492  ·  view source on GitHub ↗

Return whether *x* is a TensorFlow Tensor or Variable.

(x)

Source from the content-addressed store, hash-verified

2476
2477
2478def _is_tensorflow_array(x):
2479 """Return whether *x* is a TensorFlow Tensor or Variable."""
2480 try:
2481 # We're intentionally not attempting to import TensorFlow. If somebody
2482 # has created a TensorFlow array, TensorFlow should already be in
2483 # sys.modules we use `is_tensor` to not depend on the class structure
2484 # of TensorFlow arrays, as `tf.Variables` are not instances of
2485 # `tf.Tensor` (they both convert the same way).
2486 is_tensor = sys.modules.get("tensorflow").is_tensor
2487 except AttributeError:
2488 return False
2489 try:
2490 return is_tensor(x)
2491 except Exception:
2492 return False # Just in case it's a very nonstandard module.
2493
2494
2495def _unpack_to_numpy(x):

Callers 1

_unpack_to_numpyFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…