Tests if `x` is a `torch.Tensor` or `np.ndarray`.
(x)
| 25 | |
| 26 | |
| 27 | def 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 | |
| 40 | class BaseOutput(OrderedDict): |
nothing calls this directly
no test coverage detected