Skip to content

Commit a72a1ef

Browse files
committed
Add docstrings to _is_torch_array and _is_jax_array
1 parent 3d294d1 commit a72a1ef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/cbook.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,13 +2235,15 @@ def _picklable_class_constructor(mixin_class, fmt, attr_name, base_class):
22352235

22362236

22372237
def _is_torch_array(x):
2238+
"""Check if 'x' is a PyTorch Tensor."""
22382239
try:
22392240
return isinstance(x, sys.modules['torch'].Tensor)
22402241
except Exception as e: # not using bare `except` to bypass flake8
22412242
return False
22422243

22432244

22442245
def _is_jax_array(x):
2246+
"""Check if 'x' is a JAX Array."""
22452247
try:
22462248
return isinstance(x, sys.modules['jax'].Array)
22472249
except Exception as e: # not using bare `except` to bypass flake8

0 commit comments

Comments
 (0)