PyTorch
torch / torch
torch.is_tensor¶
-
torch.
is_tensor
(obj)[source]¶ Returns True if obj is a PyTorch tensor.
Note that this function is simply doing
isinstance(obj, Tensor)
. Using thatisinstance
check is better for typechecking with mypy, and more explicit - so it’s recommended to use that instead ofis_tensor
.- Parameters
obj (Object) – Object to test
此页内容是否对您有帮助
感谢反馈!