This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------------- | |
-- An implementation of SGD adapted with features of Nesterov's | |
-- Accelerated Gradient method, based on the paper | |
-- On the Importance of Initialization and Momentum in Deep Learning | |
-- Sutsveker et. al., ICML 2013 | |
-- | |
-- ARGS: | |
-- opfunc : a function that takes a single input (X), the point of | |
-- evaluation, and returns f(X) and df/dX | |
-- x : the initial point |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'torch' | |
function calc(N, Niter) | |
-- init conditions: | |
local u = torch.zeros(N,N) | |
u[1] = 1 | |
-- Assume u is square | |
local nx,ny = u:size(1), u:size(2) |