MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / is_tensor

Function is_tensor

diffusers/src/diffusers/utils/outputs.py:27–37  ·  view source on GitHub ↗

Tests if `x` is a `torch.Tensor` or `np.ndarray`.

(x)

Source from the content-addressed store, hash-verified

25
26
27def is_tensor(x) -> bool:
28 """
29 Tests if `x` is a `torch.Tensor` or `np.ndarray`.
30 """
31 if is_torch_available():
32 import torch
33
34 if isinstance(x, torch.Tensor):
35 return True
36
37 return isinstance(x, np.ndarray)
38
39
40class BaseOutput(OrderedDict):

Callers

nothing calls this directly

Calls 1

is_torch_availableFunction · 0.85

Tested by

no test coverage detected