Skip to content

Instantly share code, notes, and snippets.

def my_adam_step(p, lr, mom, mom_damp, step, sqr_mom, sqr_damp, grad_avg, sqr_avg, eps, wd, **kwargs):
debias1 = debias(mom, mom_damp, step)
debias2 = debias(sqr_mom, sqr_damp, step)
grad_avg_debiased = grad_avg / debias1
grad_var_debiased = sqr_avg / debias2
p.data = p.data - lr * ((grad_avg_debiased) / (grad_var_debiased.sqrt() + eps) + wd * p.data)
return p
my_adam_step._defaults = dict(eps=1e-5, wd=0.)
for seed in (7, 42, 10914):
fix_seeds(seed)
learn,run = get_learn_run(nfs, data, 0.001, conv_layer, cbs=cbfs, opt_func=adam_opt(wd=1e-2))
run.fit(10, learn)
print('-'*80)
for seed in (7, 42, 10914):
fix_seeds(seed)
learn,run = get_learn_run(nfs, data, 0.001, conv_layer, cbs=cbfs, opt_func=adam_opt())
run.fit(10, learn)
print('-'*80)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>duff's device</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>caching array length</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Set vs Array</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jinpan
jinpan / index.html
Last active July 24, 2016 02:50
Math.random vs Math.sin (http://jsbench.github.io/#f8f884c637666139edc1c95855e61f54) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Math.random vs Math.sin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>looping</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jinpan
jinpan / index.html
Last active July 6, 2016 06:37
Array sizes vs Lookup speed #jsbench #jsperf (https://jsbench.github.io/#30270be3d6d834b6c78f96e0297c0eec) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Array sizes vs Lookup speed #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
f = function*(__wl_agt, __wl_scp){ ;
;
let __wl_171_param_name = String("n");
;
;