MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / build_test_cases

Function build_test_cases

tests/optimizers/test_optim_novograd.py:23–41  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

21
22
23def 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
44TEST_CASES_ALL = build_test_cases([torch.randn(10, 5), torch.randn(10), torch.randn(5)]) # normal parameters

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…