(data)
| 21 | |
| 22 | |
| 23 | def build_test_cases(data): |
| 24 | [weight, bias, input] = data |
| 25 | weight = Variable(weight, requires_grad=True) |
| 26 | bias = Variable(bias, requires_grad=True) |
| 27 | input = Variable(input) |
| 28 | |
| 29 | default_params = {"lr": 1e-3, "amsgrad": False, "grad_averaging": False, "weight_decay": 0} |
| 30 | |
| 31 | test_case_same_param = [{"params": [weight, bias]}] |
| 32 | test_case_diff_param = [ |
| 33 | {"params": [weight]}, |
| 34 | {"params": [bias], "lr": 1e-2, "amsgrad": True, "grad_averaging": True, "weight_decay": 0.1}, |
| 35 | ] |
| 36 | |
| 37 | test_cases = [ |
| 38 | [test_case_same_param, default_params, weight, bias, input], |
| 39 | [test_case_diff_param, default_params, weight, bias, input], |
| 40 | ] |
| 41 | return test_cases |
| 42 | |
| 43 | |
| 44 | TEST_CASES_ALL = build_test_cases([torch.randn(10, 5), torch.randn(10), torch.randn(5)]) # normal parameters |
no outgoing calls
no test coverage detected
searching dependent graphs…