Solver

Quick Reference

List Brief
Solver.step Step the train net.
Solver.snapshot Snapshot the parameters of train net.
Solver.net Return the train net.
Solver.test_nets Return the test nets.
Solver.iter Return or Set the current iteration.
Solver.lr Return or Set the current learning rate.

API Reference

class dragon.vm.caffe.solver.Solver(proto_txt)

Solver merges updates to optimize the Net.

Inspired by SolverWrapper, we simplified it from the original C++ implementation.

__init__(proto_txt)

Construct a Solver.

Parameters:proto_txt (str) – The path of .prototxt file.
Returns:The solver.
Return type:Solver

Examples

>>> solver = Solver('solver.prototxt')
InitTrainNet()

Initialize the train net.

Returns:
Return type:None

References

The implementation of InitTrainNet(solver.cpp, L63).

InitTestNets()

Initialize the test nets.

Returns:
Return type:None

References

The implementation of InitTestNets(solver.cpp, L104).

BuildNets()

Build the nets.

Returns:
Return type:None

See also

Net.function(*args, **kwargs) - How to transform Net into Graph.

ParseOptimizerArguments()

Parse the arguments for optimizer.

Returns:
Return type:None
BuildOptimizer()

Build the optimizer.

Returns:
Return type:None
GetLearningRate()

Get learning rate based on the preset policy.

Returns:
Return type:None

References

The implementation of GetLearningRate(solver.cpp, L27).

Test(test_idx)

Test the specific net.

Parameters:test_idx (int) – The idx of test net.
Returns:
Return type:None

References

The implementation of Test(solver.cpp, L328).

step(iters)

Step the train net. [PyCaffe Style]

Parameters:iters (int) – The number of iterations to step.
Returns:
Return type:None

References

The implementation of Step(solver.cpp, L180).

one_step()

One step run the train net.

Returns:The stats.
Return type:dict
snapshot()

Snapshot the parameters of train net. [PyCaffe Style]

Returns:
Return type:None

See also

workspace.Snapshot(*args, **kwargs) - How to snapshot tensors into a file.

References

The implementation of Snapshot(solver.cpp, L403).

net

Return the train net. [PyCaffe Style]

Returns:The train net.
Return type:Net
test_nets

Return the test nets. [PyCaffe Style]

Returns:The test nets.
Return type:list of Net
iter

Return or Set the current iteration. [PyCaffe Style]

Parameters:iter (int) – The value of iteration to set.
Returns:
Return type:The current iteration.
base_lr

Return or Set the current learning rate. [Extended]

Parameters:iter (float) – The value of learning rate to set.
Returns:
Return type:The current learning rate.
class dragon.vm.caffe.solver.SGDSolver(proto_txt)

The Momentum-SGD Solver, introduced by [LeCun et.al, 1998].

Parameters:
ParseOptimizerArguments()

Parse the arguments for optimizer.

Returns:
Return type:None
class dragon.vm.caffe.solver.NesterovSolver(proto_txt)

The Nesterov-SGD Solver, introduced by [Sutskever et.al, 2012].

Parameters:
ParseOptimizerArguments()

Parse the arguments for optimizer.

Returns:
Return type:None
class dragon.vm.caffe.solver.RMSPropSolver(proto_txt)

The RMSProp Solver, introduced by [Hinton et.al, 2013].

Parameters:
ParseOptimizerArguments()

Parse the arguments for optimizer.

Returns:
Return type:None
class dragon.vm.caffe.solver.AdamSolver(proto_txt)

The Adam Solver, introduced by [Kingma & Ba, 2014].

Parameters:
ParseOptimizerArguments()

Parse the arguments for optimizer.

Returns:
Return type:None