MCPcopy Create free account
hub / github.com/apache/tvm / np_func

Function np_func

tests/python/relax/test_training_optimizer_numeric.py:90–98  ·  view source on GitHub ↗
(param_tuple, grad_tuple, state_tuple)

Source from the content-addressed store, hash-verified

88@tvm.testing.parametrize_targets("llvm")
89def test_sgd(target, dev, lr, weight_decay):
90 def np_func(param_tuple, grad_tuple, state_tuple):
91 num_steps = state_tuple[0]
92 param_tuple_new, state_tuple_new = [], []
93 state_tuple_new.append(num_steps + 1)
94 for i in range(len(param_tuple)):
95 param = param_tuple[i]
96 grad = grad_tuple[i]
97 param_tuple_new.append(param - lr * (grad + weight_decay * param))
98 return param_tuple_new, state_tuple_new
99
100 _test_optimizer(target, dev, np_func, SGD, lr, weight_decay)
101

Callers 4

_assert_run_result_sameFunction · 0.85
run_testFunction · 0.85
run_testFunction · 0.85
run_testFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…