def to_numpy(var): #if ia.is_numpy_array(var): if isinstance(var, (np.ndarray, np.generic)): return var else: return var.data.cpu().numpy()