(split, target)
| 224 | |
| 225 | |
| 226 | def get_variable(split, target): |
| 227 | device = torch.device("cuda" if torch.cuda.is_available() else "cpu") |
| 228 | num = len(target) |
| 229 | var = [] |
| 230 | if split == "train": |
| 231 | for i in range(num): |
| 232 | temp = target[i].requires_grad_(False).contiguous().float().to(device) |
| 233 | var.append(temp) |
| 234 | else: |
| 235 | for i in range(num): |
| 236 | temp = target[i].contiguous().float().to(device) |
| 237 | var.append(temp) |
| 238 | |
| 239 | return var |
| 240 | |
| 241 | |
| 242 | def print_error(data_type, action_error_sum, is_train): |
no outgoing calls