(vars)
| 107 | |
| 108 | @make_recursive_func |
| 109 | def tensor2numpy(vars): |
| 110 | if isinstance(vars, np.ndarray): |
| 111 | return vars |
| 112 | elif isinstance(vars, torch.Tensor): |
| 113 | return vars.detach().cpu().numpy().copy() |
| 114 | else: |
| 115 | raise NotImplementedError("invalid input type {} for tensor2numpy".format(type(vars))) |
| 116 | |
| 117 | |
| 118 | @make_recursive_func |
no outgoing calls
no test coverage detected