The background is A3C algorithm, where many worker threads share a common network parameters and share a common rmsprop states, with each thread holding its own gradParameters. Periodically, each worker thread updates the common parameters using the common rmsprop states with its own gradParameters in a lock-free, asynchronous way.
Previously in Torch 7, it’s rather easy to do this with threads and optim library:
-- in main thread: shared parameters
params, _ = sharedNet:getParameters()

-- in worker thread: its own gradParameters
tNet = sharedNet:clone()
_, gradParams = tNet:getParameters()

-- in worker thread: stuff

-- in worker thread: updating shared parameters with its own gradParameters
function feval() return nil, gradParams end
optim.rmsprop(feval, params, sharedStates)

But I don’t see an obvious way to do the same thing with pytorch, because now the parameters and gradParameters are tied together under the nn.Parameter class… Any suggestion for it? (I find the mnist_hogwild.py example but the updating details are different from what I described above.)
Thanks in advance!