(x)
| 27 | # Akin to `torch.is_tensor`, but returns True for Variable |
| 28 | # objects in pre-0.4. |
| 29 | def is_tensor_like(x): |
| 30 | return torch.is_tensor(x) or isinstance(x, torch.autograd.Variable) |
| 31 | |
| 32 | # Wraps `torch.is_floating_point` if present, otherwise checks |
| 33 | # the suffix of `x.type()`. |