(obj)
| 30 | |
| 31 | |
| 32 | def get_a_var(obj): # pragma: no cover |
| 33 | if isinstance(obj, torch.Tensor): |
| 34 | return obj |
| 35 | |
| 36 | if isinstance(obj, list) or isinstance(obj, tuple): |
| 37 | for result in map(get_a_var, obj): |
| 38 | if isinstance(result, torch.Tensor): |
| 39 | return result |
| 40 | if isinstance(obj, dict): |
| 41 | for result in map(get_a_var, obj.items()): |
| 42 | if isinstance(result, torch.Tensor): |
| 43 | return result |
| 44 | return None |
| 45 | |
| 46 | |
| 47 | def data_loader(fn): |