File: test_adadelta.lua

package info (click to toggle)
lua-torch-optim 0~20171127-ga5ceed7-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 548 kB
  • sloc: makefile: 8
file content (23 lines) | stat: -rw-r--r-- 382 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'torch'
require 'optim'

require 'rosenbrock'
require 'l2'

x = torch.Tensor(2):fill(0)
fx = {}
state = {}
config = {eps=1e-10}
for i = 1,10001 do
	x,f=optim.adadelta(rosenbrock,x,config,state)
	if (i-1)%1000 == 0 then
		table.insert(fx,f[1])
	end
end

print()
print('Rosenbrock test')
print()
print('x=');print(x)
print('fx=')
for i=1,#fx do print((i-1)*1000+1,fx[i]); end