MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.solvers.Solver< T > Class Template Referenceabstract

An interface for classes that perform optimization on Nets - this class serves as the base class for all solvers. More...

Inheritance diagram for MyCaffe.solvers.Solver< T >:
MyCaffe.solvers.LBFGSSolver< T > MyCaffe.solvers.SGDSolver< T > MyCaffe.solvers.AdaDeltaSolver< T > MyCaffe.solvers.AdaGradSolver< T > MyCaffe.solvers.AdamSolver< T > MyCaffe.solvers.AdamWSolver< T > MyCaffe.solvers.NesterovSolver< T > MyCaffe.solvers.RmsPropSolver< T >

Public Member Functions

 Solver (CudaDnn< T > cuda, Log log, SolverParameter p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXDatabaseBase db, IXPersist< T > persist, int nSolverCount=1, int nSolverRank=0, Net< T > shareNet=null, onGetWorkspace getws=null, onSetWorkspace setws=null)
 The Solver constructor. More...
 
void Dispose ()
 Discards the resources (GPU and Host) used by this Solver. More...
 
bool ForceOnTrainingIterationEvent ()
 Force an OnTrainingIterationEvent to fire. More...
 
void Init (SolverParameter p, Net< T > shareNet=null)
 Initializes the Solver. More...
 
void Reset ()
 Reset the iterations of the net. More...
 
virtual void Solve (int nIterationOverride=-1, byte[] rgWeights=null, byte[] rgState=null, TRAIN_STEP step=TRAIN_STEP.NONE)
 The main entry of the solver function. In default, iter will be zero. Pass in a non-zero iter number to resume training for a pre-trained net. More...
 
bool Step (int nIters, TRAIN_STEP step=TRAIN_STEP.NONE, bool bZeroDiffs=true, bool bApplyUpdates=true, bool bDisableOutput=false, bool bDisableProgress=false, double? dfLossOverride=null, bool? bAllowSnapshot=null)
 Steps a set of iterations through a training cycle. More...
 
void Restore (byte[] rgWeights, byte[] rgState, string strSkipBlobTypes=null)
 The restore method simply calls the RestoreSolverState method of the inherited class. More...
 
void Snapshot (bool bForced, bool bScheduled, bool bUpdateDatabase=true)
 The snapshot function implements the basic snapshotting utility that stores the learned net. This method calls the SnapshotSolverState method of the inherited class. More...
 
SnapshotArgs GetSnapshotArgs (byte[] rgState, byte[] rgWeights, double dfAccuracy, double dfError, int nIteration, SNAPSHOT_WEIGHT_UPDATE_METHOD wtUpdt)
 The GetSnapshotArgs method fills out a snapshot args structure. More...
 
double TestAll (int nIterationOverride=-1)
 Run a TestAll by running all test Nets. More...
 
double TestDetection (int nIterationOverride=-1, int nTestNetId=0)
 Run an SSD detection test on a given test Net by running it through its iterations. More...
 
double TestClassification (int nIterationOverride=-1, int nTestNetId=0)
 Run a test on a given test Net by running it through its iterations. More...
 
void UpdateSmoothedLoss (double dfLoss, int nStartIter, int nAverageLoss=0)
 Update the avaraged loss value. More...
 
abstract double ApplyUpdate (int nIterationOverride=-1)
 Make and apply the update value for the current iteration. More...
 

Static Public Member Functions

static SGDSolver< T > Create (CudaDnn< T > cuda, Log log, ProjectEx p, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXDatabaseBase db, IXPersist< T > persist, int nSolverCount=1, int nSolverRank=0, Net< T > shareNet=null, onGetWorkspace getws=null, onSetWorkspace setws=null)
 Create a new Solver based on the project containing the SolverParameter. More...
 
static SGDSolver< T > Create (CudaDnn< T > cuda, Log log, SolverParameter solverParam, CancelEvent evtCancel, AutoResetEvent evtForceSnapshot, AutoResetEvent evtForceTest, IXDatabaseBase db, IXPersist< T > persist, int nSolverCount=1, int nSolverRank=0, Net< T > shareNet=null, onGetWorkspace getws=null, onSetWorkspace setws=null)
 Create a new Solver based on the project containing the SolverParameter. More...
 

Protected Member Functions

virtual void dispose ()
 Override that allows discarding of resources (GPU and Host) used by this Solver. More...
 
void InitTrainNet (Net< T > shareNet=null)
 Initializes the Net used by the solver for training. More...
 
void InitTestNets ()
 Initializes the Net used by the Solver for testing. More...
 
abstract byte[] SnapshotSolverState ()
 Save the current solver state. More...
 
abstract void RestoreSolverState (byte[] rgState)
 Restore a solver state. More...
 

Protected Attributes

CudaDnn< T > m_cuda
 Specifies the instance of CudaDnn used by the Solver that provides a connection to Cuda. More...
 
Log m_log
 Specifies the Log for output. More...
 
SolverParameter m_param
 Specifies the SolverParameter that defines how the Solver operates. More...
 
Net< T > m_net
 Specifies the training Net. More...
 
List< Net< T > > m_rgTestNets = new List<Net<T>>()
 Specifies the testing Nets. More...
 
int m_nIter
 Specifies the current iteration. More...
 
int m_nCurrentStep
 Specifies the current step. More...
 
List< double > m_rgLosses = new List<double>()
 Specifies the Losses used to calculate the smoothed Loss. More...
 
double m_dfSmoothedLoss = 0
 Specifies the smoothed loss protected for derived classes to use. More...
 
double? m_dfIterAccuracy = null
 Specifies the iteration accuracy calculated when a blob exists with the name 'accuracy'. More...
 
int m_nSolverCount = 1
 Specifies the Solver count in a multi-GPU training session. More...
 
int m_nSolverRank = 0
 Specifies the Solver rank of this solver, where rank == 0 is the root Solver. More...
 
IXPersist< T > m_persist
 Specifies the persistance object used to save weight and solver states. More...
 
double m_dfLearningRateOverride = 0
 Optionally, specifies a learning rate override (default = 0, which ignores this setting). More...
 

Properties

double LearningRateOverride [getset]
 Get/set the learning rate override. When 0, this setting is ignored. More...
 
int TrainingTimeLimitInMinutes [getset]
 Get/set the training time limit in minutes. When set to 0, no time limit is imposed on training. More...
 
SNAPSHOT_WEIGHT_UPDATE_METHOD SnapshotWeightUpdateMethod [getset]
 Get/set the snapshot weight update method. More...
 
IXDatabaseBase Database [get]
 Returns the in-memory MyCaffeDatabase used. More...
 
bool EnableTesting [getset]
 When enabled, the training cycle calls TestAll periodically based on the SolverParameter. Otherwise testing is not performed. More...
 
bool EnableBlobDebugging [getset]
 When enabled, the OnTrainingIteration event is set extra debugging information describing the state of each Blob used by the Solver. More...
 
bool EnableLayerDebugging [getset]
 Enable/disable layer debugging which causes each layer to check for NAN/INF on each forward/backward pass and throw an exception when found. More...
 
bool EnableBreakOnFirstNaN [getset]
 When enabled (requires EnableBlobDebugging = true), the Solver immediately stop training upon detecting the first NaN withing the training Net. More...
 
bool EnableDetailedNanDetection [getset]
 When enabled (requires EnableBlobDebugging = true), the detailed Nan (and Infinity) detection is perofmed on each blob when training Net. More...
 
bool EnableSingleStep [getset]
 When enabled (requires EnableBlobDebugging = true), the Solver only runs one training cycle. More...
 
bool WeightsUpdated [getset]
 Get/set when the weights have been updated. More...
 
object Tag [getset]
 Returns a generic tag associated with the Solver. More...
 
Net< T > TestingNet [get]
 Returns the testing Net used by the solver. More...
 
Net< T > TrainingNet [get]
 Returns the training Net used by the solver. More...
 
CudaDnn< T > Cuda [get]
 Returns the CudaDnn instance used by the Solver. More...
 
string ActiveLabelCounts [get]
 Returns a string describing the labels detected in the training along with the % that each label has participated in the training. More...
 
string LabelQueryHitPercents [get]
 Return the label query hit percentages for the active datasource. More...
 
string LabelQueryEpochs [get]
 Return the label query epochs for the active datasource. More...
 
int CurrentIteration [get]
 Returns the current training iteration. More...
 
int MaximumIteration [get]
 Returns the maximum training iterations. More...
 
int TrainingIterations [get]
 Returns the current training iterations remaining. More...
 
int? TestingIterations [get]
 Returns the current testing iterations remaining. More...
 
int TrainingIterationOverride [getset]
 Get/set the training iteration override. More...
 
int TestingIterationOverride [getset]
 Get/set the testing iteration override. More...
 
AutoResetEvent CompletedEvent [get]
 Returns an auto reset event that is set upon training completion. More...
 
CancelEvent CancelEvent [get]
 Returns the cancel event which when set cancels the current operation run by the Solver. More...
 
double smoothed_loss [get]
 Returns the smoothed loss. More...
 
SolverParameter parameter [get]
 Returns the SolverParameter used. More...
 
Net< T > net [get]
 Returns the main training Net. More...
 
List< Net< T > > test_nets [get]
 Returns the testing Nets. More...
 
int iter [get]
 Returns the current training iteration. More...
 
SolverParameter.SolverType type [get]
 Returns the type of solver. More...
 
bool forceSnapshot [get]
 Returns whether or not a snapshot has been forced. More...
 
bool forceTest [get]
 Returns whether or not a test has been forced. More...
 
int solver_count [get]
 Returns the solver count in a multi-GPU session. More...
 
int solver_rank [get]
 Returns this Solver's rank in a multi-GPU session. More...
 
bool? is_root_solver [get]
 Returns whether or not this is the root solver. More...
 

Events

EventHandler OnStart
 The OnStart event fires at the start of each training iteration. More...
 
EventHandler OnAborted
 The OnAborted event fires after aborting a training cycle. More...
 
EventHandler< GradientsReadyArgsOnGradientsReady
 The OnGradientsReady event fires after the gradients of a Solver are ready for distribution to other Solvers in a multi-GPU training session. More...
 
EventHandler< SnapshotArgsOnSnapshot
 The OnSnapshot event fires when the Solver detects that a snapshot is needed. More...
 
EventHandler< TrainingIterationArgs< T > > OnTrainingIteration
 The OnTrainingIteration event fires at the end of each training iteration. More...
 
EventHandler< TestingIterationArgs< T > > OnTestingIteration
 The OnTestingIteration event fires at the end of each testing iteration. More...
 
EventHandler< TestResultArgs< T > > OnTestResults
 When specified, the OnTestResults event fires after each single test run. The recipient is responsible for setting the accuracy. More...
 
EventHandler< TestArgsOnTest
 When specified, the OnTest event fires during a TestAll and overrides the call to Test. More...
 
EventHandler OnTestStart
 The OnTestStart event fires at the start of each testing iteration. More...
 
EventHandler< CustomForwardBackArgs< T > > OnCustomForwardBack
 The OnCustomForwardBack allows for overriding the forward/backward operations within the solver. More...
 
EventHandler< WorkspaceArgsOnGetWorkspace
 Specifies the OnGetWorkspace event that fires when the getWorkspace() function is called by a layer to get a shareable workspace to conserve GPU memory. More...
 
EventHandler< WorkspaceArgsOnSetWorkspace
 Specifies the OnSetWorkspace event that fires when the setWorkspace() function is called by a layer to get a shareable workspace to conserve GPU memory. More...
 

Detailed Description

An interface for classes that perform optimization on Nets - this class serves as the base class for all solvers.

Requires implementation of ApplyUpdate to compute a parameter update given the current state of the Net parameters.

Template Parameters
TSpecifies the base type float or double. Using float is recommended to conserve GPU memory.

Definition at line 27 of file Solver.cs.

Constructor & Destructor Documentation

◆ Solver()

MyCaffe.solvers.Solver< T >.Solver ( CudaDnn< T >  cuda,
Log  log,
SolverParameter  p,
CancelEvent  evtCancel,
AutoResetEvent  evtForceSnapshot,
AutoResetEvent  evtForceTest,
IXDatabaseBase  db,
IXPersist< T >  persist,
int  nSolverCount = 1,
int  nSolverRank = 0,
Net< T >  shareNet = null,
onGetWorkspace  getws = null,
onSetWorkspace  setws = null 
)

The Solver constructor.

Parameters
cudaSpecifies the instance of CudaDnn to use.
logSpecifies the Log for output.
pSpecifies teh SolverParameter.
evtCancelSpecifies a CancelEvent used to cancel the current operation (e.g. training, testing) for which the Solver is performing.
evtForceSnapshotSpecifies an automatic reset event that causes the Solver to perform a Snapshot when set.
evtForceTestSpecifies an automatic reset event that causes teh Solver to run a testing cycle when set.
dbSpecifies the in-memory MyCaffeDatabase.
persistSpecifies the peristence used for loading and saving weights.
nSolverCountSpecifies the number of Solvers participating in a multi-GPU session.
nSolverRankSpecifies the rank of this Solver in a multi-GPU session.
shareNetOptionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).
getwsOptionally, specifies the handler for getting the workspace.
setwsOptionally, specifies the handler for setting the workspace.

Definition at line 181 of file Solver.cs.

Member Function Documentation

◆ ApplyUpdate()

abstract double MyCaffe.solvers.Solver< T >.ApplyUpdate ( int  nIterationOverride = -1)
pure virtual

Make and apply the update value for the current iteration.

Parameters
nIterationOverrideOptionally, specifies an iteration override, or -1 which is ignored.

Implemented in MyCaffe.solvers.LBFGSSolver< T >, and MyCaffe.solvers.SGDSolver< T >.

◆ Create() [1/2]

static SGDSolver< T > MyCaffe.solvers.Solver< T >.Create ( CudaDnn< T >  cuda,
Log  log,
ProjectEx  p,
CancelEvent  evtCancel,
AutoResetEvent  evtForceSnapshot,
AutoResetEvent  evtForceTest,
IXDatabaseBase  db,
IXPersist< T >  persist,
int  nSolverCount = 1,
int  nSolverRank = 0,
Net< T >  shareNet = null,
onGetWorkspace  getws = null,
onSetWorkspace  setws = null 
)
static

Create a new Solver based on the project containing the SolverParameter.

Parameters
cudaSpecifies the CudaDnn instance that the new Solver will use.
logSpecifies the Log for output that the new Solver will use.
pSpecifies the project to use in initialzing the new Solver.
evtCancelSpecifies the CancelEvent that the new Solver will use.
evtForceSnapshotSpecifies the force snapshot event that the new Solver will use.
evtForceTestSpecifies the force test event that the new Solver will use.
dbSpecifies the in-memory MyCaffeDatabase that the new Solver will use.
persistSpecifies the peristence used for loading and saving weights.
nSolverCountSpecifies the number of Solvers participating in a multi-GPu session.
nSolverRankSpecifies the rank of the new Solver.
shareNetOptionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).
getwsOptionally, specifies the handler for getting the workspace.
setwsOptionally, specifies the handler for setting the workspace.
Returns
A new Solver instance is returned.

Definition at line 1889 of file Solver.cs.

◆ Create() [2/2]

static SGDSolver< T > MyCaffe.solvers.Solver< T >.Create ( CudaDnn< T >  cuda,
Log  log,
SolverParameter  solverParam,
CancelEvent  evtCancel,
AutoResetEvent  evtForceSnapshot,
AutoResetEvent  evtForceTest,
IXDatabaseBase  db,
IXPersist< T >  persist,
int  nSolverCount = 1,
int  nSolverRank = 0,
Net< T >  shareNet = null,
onGetWorkspace  getws = null,
onSetWorkspace  setws = null 
)
static

Create a new Solver based on the project containing the SolverParameter.

Parameters
cudaSpecifies the CudaDnn instance that the new Solver will use.
logSpecifies the Log for output that the new Solver will use.
solverParamSpecifies the SolverParameter used to create the Solver.
evtCancelSpecifies the CancelEvent that the new Solver will use.
evtForceSnapshotSpecifies the force snapshot event that the new Solver will use.
evtForceTestSpecifies the force test event that the new Solver will use.
dbSpecifies the in-memory MyCaffeDatabase that the new Solver will use.
persistSpecifies the peristence used for loading and saving weights.
nSolverCountSpecifies the number of Solvers participating in a multi-GPu session.
nSolverRankSpecifies the rank of the new Solver.
shareNetOptionally, specifies the net to share when creating the training network (default = null, meaning no share net is used).
getwsOptionally, specifies the handler for getting the workspace.
setwsOptionally, specifies the handler for setting the workspace.
Returns

Definition at line 1930 of file Solver.cs.

◆ Dispose()

void MyCaffe.solvers.Solver< T >.Dispose ( )

Discards the resources (GPU and Host) used by this Solver.

Definition at line 218 of file Solver.cs.

◆ dispose()

virtual void MyCaffe.solvers.Solver< T >.dispose ( )
protectedvirtual

Override that allows discarding of resources (GPU and Host) used by this Solver.

Reimplemented in MyCaffe.solvers.LBFGSSolver< T >, and MyCaffe.solvers.SGDSolver< T >.

Definition at line 317 of file Solver.cs.

◆ ForceOnTrainingIterationEvent()

bool MyCaffe.solvers.Solver< T >.ForceOnTrainingIterationEvent ( )

Force an OnTrainingIterationEvent to fire.

Returns
When fired, true is returned, otherwise false.

Definition at line 236 of file Solver.cs.

◆ GetSnapshotArgs()

SnapshotArgs MyCaffe.solvers.Solver< T >.GetSnapshotArgs ( byte[]  rgState,
byte[]  rgWeights,
double  dfAccuracy,
double  dfError,
int  nIteration,
SNAPSHOT_WEIGHT_UPDATE_METHOD  wtUpdt 
)

The GetSnapshotArgs method fills out a snapshot args structure.

Parameters
rgStateSpecifies the state bytes or null.
rgWeightsSpecifies the weight bytes or null.
dfAccuracySpecifies the accuracy.
dfErrorSpecifies the error.
nIterationSpecifies the interation.
wtUpdtSpecifies the weight update method.
Returns
The args are returned.

Definition at line 1159 of file Solver.cs.

◆ Init()

void MyCaffe.solvers.Solver< T >.Init ( SolverParameter  p,
Net< T >  shareNet = null 
)

Initializes the Solver.

Parameters
pSpecifies the SolverParameters used to initialize the Solver.
shareNetOptionally, specifies a network to share (default = null).

Definition at line 454 of file Solver.cs.

◆ InitTestNets()

void MyCaffe.solvers.Solver< T >.InitTestNets ( )
protected

Initializes the Net used by the Solver for testing.

Definition at line 579 of file Solver.cs.

◆ InitTrainNet()

void MyCaffe.solvers.Solver< T >.InitTrainNet ( Net< T >  shareNet = null)
protected

Initializes the Net used by the solver for training.

Parameters
shareNetOptionally, specifies a network to share (default = null).

Definition at line 488 of file Solver.cs.

◆ Reset()

void MyCaffe.solvers.Solver< T >.Reset ( )

Reset the iterations of the net.

Definition at line 478 of file Solver.cs.

◆ Restore()

void MyCaffe.solvers.Solver< T >.Restore ( byte[]  rgWeights,
byte[]  rgState,
string  strSkipBlobTypes = null 
)

The restore method simply calls the RestoreSolverState method of the inherited class.

Parameters
rgWeightsSpecifies the weights to load, or null to ignore.
rgStateSpecifies the state to load, or null to ignore.
strSkipBlobTypesSpecifies the blob types to ignore and not load, or null to ignore.

Definition at line 1097 of file Solver.cs.

◆ RestoreSolverState()

abstract void MyCaffe.solvers.Solver< T >.RestoreSolverState ( byte[]  rgState)
protectedpure virtual

Restore a solver state.

Implemented in MyCaffe.solvers.LBFGSSolver< T >, and MyCaffe.solvers.SGDSolver< T >.

◆ Snapshot()

void MyCaffe.solvers.Solver< T >.Snapshot ( bool  bForced,
bool  bScheduled,
bool  bUpdateDatabase = true 
)

The snapshot function implements the basic snapshotting utility that stores the learned net. This method calls the SnapshotSolverState method of the inherited class.

Parameters
bForcedSpecifies whehter or not to force the snapshot.
bScheduledSpecifies whether or not the snapshot is a scheduled snapshot that occurs at regular intervals, or a snapshot based on an improving accuracy.
bUpdateDatabaseOptionally, specifies to update the database (default = true).

Definition at line 1115 of file Solver.cs.

◆ SnapshotSolverState()

abstract byte[] MyCaffe.solvers.Solver< T >.SnapshotSolverState ( )
protectedpure virtual

Save the current solver state.

Implemented in MyCaffe.solvers.LBFGSSolver< T >, and MyCaffe.solvers.SGDSolver< T >.

◆ Solve()

virtual void MyCaffe.solvers.Solver< T >.Solve ( int  nIterationOverride = -1,
byte[]  rgWeights = null,
byte[]  rgState = null,
TRAIN_STEP  step = TRAIN_STEP.NONE 
)
virtual

The main entry of the solver function. In default, iter will be zero. Pass in a non-zero iter number to resume training for a pre-trained net.

Parameters
nIterationOverrideOptionally, specifies an iteration override value to use for the number of iterations run. The default is -1, which ignores the parameter.
rgWeightsOptionally, specifies weights to load via the Restore method. The default is null which ignores the parameter.
rgStateOptionally, specifies the state to load via the Restore method. The default is null which ignores the parameter.
stepOptionally, specifies to single step the training pass - typically this is used during debugging. The default = TRAIN_STEP.NONE which runs the solver in the normal manner.

Definition at line 744 of file Solver.cs.

◆ Step()

bool MyCaffe.solvers.Solver< T >.Step ( int  nIters,
TRAIN_STEP  step = TRAIN_STEP.NONE,
bool  bZeroDiffs = true,
bool  bApplyUpdates = true,
bool  bDisableOutput = false,
bool  bDisableProgress = false,
double?  dfLossOverride = null,
bool?  bAllowSnapshot = null 
)

Steps a set of iterations through a training cycle.

Parameters
nItersSpecifies the number of steps to iterate.
stepOptionally, specifies to single step the training pass - typically this is used during debugging. The default = TRAIN_STEP.NONE for no stepping.
bZeroDiffsOptionally, specifies whether or not to zero out the gradient diffs (default = true).
bApplyUpdatesOptionally, specifies to apply the gradient updates to the weights (default = true).
bDisableOutputOptionally, disable the output to the log.
bDisableProgressOptionally, disables the progress updating to the log.
dfLossOverrideOptionally, specifies a loss override which can be useful when using a backward step only.
bAllowSnapshotOptionally, specifies whether or not a snapshot is allowed even during TRAIN_STEP.
Returns

Definition at line 818 of file Solver.cs.

◆ TestAll()

double MyCaffe.solvers.Solver< T >.TestAll ( int  nIterationOverride = -1)

Run a TestAll by running all test Nets.

Depending on the eval_type tests are run as Test (default), TestClassification (for SSD Classification), or TestDetection (for SSD Detection).

Parameters
nIterationOverrideSpecifies an override to the iterations to run.
Returns
The accuracy of the testing run is returned as a percentage value in the range [0, 1].

Definition at line 1322 of file Solver.cs.

◆ TestClassification()

double MyCaffe.solvers.Solver< T >.TestClassification ( int  nIterationOverride = -1,
int  nTestNetId = 0 
)

Run a test on a given test Net by running it through its iterations.

Parameters
nIterationOverrideSpecifies an override the the number of iterations to run.
nTestNetIdSpecifies the ID of the test Net to run.
Returns
The accuracy of the test run is returned as a percentage in the range [0, 1].

Definition at line 1597 of file Solver.cs.

◆ TestDetection()

double MyCaffe.solvers.Solver< T >.TestDetection ( int  nIterationOverride = -1,
int  nTestNetId = 0 
)

Run an SSD detection test on a given test Net by running it through its iterations.

Parameters
nIterationOverrideSpecifies an override the the number of iterations to run.
nTestNetIdSpecifies the ID of the test Net to run.
Returns
The accuracy of the test run is returned as a percentage in the range [0, 1].

Definition at line 1396 of file Solver.cs.

◆ UpdateSmoothedLoss()

void MyCaffe.solvers.Solver< T >.UpdateSmoothedLoss ( double  dfLoss,
int  nStartIter,
int  nAverageLoss = 0 
)

Update the avaraged loss value.

Parameters
dfLossSpecifies the new loss value to add into the average.
nStartIterSpecifies the starting iteration.
nAverageLossOptionally, specifies the number of iterations to average over (default = param.average_loss).

Definition at line 1826 of file Solver.cs.

Member Data Documentation

◆ m_cuda

CudaDnn<T> MyCaffe.solvers.Solver< T >.m_cuda
protected

Specifies the instance of CudaDnn used by the Solver that provides a connection to Cuda.

Definition at line 32 of file Solver.cs.

◆ m_dfIterAccuracy

double? MyCaffe.solvers.Solver< T >.m_dfIterAccuracy = null
protected

Specifies the iteration accuracy calculated when a blob exists with the name 'accuracy'.

Definition at line 74 of file Solver.cs.

◆ m_dfLearningRateOverride

double MyCaffe.solvers.Solver< T >.m_dfLearningRateOverride = 0
protected

Optionally, specifies a learning rate override (default = 0, which ignores this setting).

Definition at line 94 of file Solver.cs.

◆ m_dfSmoothedLoss

double MyCaffe.solvers.Solver< T >.m_dfSmoothedLoss = 0
protected

Specifies the smoothed loss protected for derived classes to use.

Definition at line 70 of file Solver.cs.

◆ m_log

Log MyCaffe.solvers.Solver< T >.m_log
protected

Specifies the Log for output.

Definition at line 36 of file Solver.cs.

◆ m_nCurrentStep

int MyCaffe.solvers.Solver< T >.m_nCurrentStep
protected

Specifies the current step.

Definition at line 56 of file Solver.cs.

◆ m_net

Net<T> MyCaffe.solvers.Solver< T >.m_net
protected

Specifies the training Net.

Definition at line 44 of file Solver.cs.

◆ m_nIter

int MyCaffe.solvers.Solver< T >.m_nIter
protected

Specifies the current iteration.

Definition at line 52 of file Solver.cs.

◆ m_nSolverCount

int MyCaffe.solvers.Solver< T >.m_nSolverCount = 1
protected

Specifies the Solver count in a multi-GPU training session.

Definition at line 82 of file Solver.cs.

◆ m_nSolverRank

int MyCaffe.solvers.Solver< T >.m_nSolverRank = 0
protected

Specifies the Solver rank of this solver, where rank == 0 is the root Solver.

Definition at line 86 of file Solver.cs.

◆ m_param

SolverParameter MyCaffe.solvers.Solver< T >.m_param
protected

Specifies the SolverParameter that defines how the Solver operates.

Definition at line 40 of file Solver.cs.

◆ m_persist

IXPersist<T> MyCaffe.solvers.Solver< T >.m_persist
protected

Specifies the persistance object used to save weight and solver states.

Definition at line 90 of file Solver.cs.

◆ m_rgLosses

List<double> MyCaffe.solvers.Solver< T >.m_rgLosses = new List<double>()
protected

Specifies the Losses used to calculate the smoothed Loss.

Definition at line 60 of file Solver.cs.

◆ m_rgTestNets

List<Net<T> > MyCaffe.solvers.Solver< T >.m_rgTestNets = new List<Net<T>>()
protected

Specifies the testing Nets.

Definition at line 48 of file Solver.cs.

Property Documentation

◆ ActiveLabelCounts

string MyCaffe.solvers.Solver< T >.ActiveLabelCounts
get

Returns a string describing the labels detected in the training along with the % that each label has participated in the training.

Definition at line 667 of file Solver.cs.

◆ CancelEvent

Returns the cancel event which when set cancels the current operation run by the Solver.

Definition at line 1204 of file Solver.cs.

◆ CompletedEvent

AutoResetEvent MyCaffe.solvers.Solver< T >.CompletedEvent
get

Returns an auto reset event that is set upon training completion.

Definition at line 1196 of file Solver.cs.

◆ Cuda

CudaDnn<T> MyCaffe.solvers.Solver< T >.Cuda
get

Returns the CudaDnn instance used by the Solver.

Definition at line 659 of file Solver.cs.

◆ CurrentIteration

int MyCaffe.solvers.Solver< T >.CurrentIteration
get

Returns the current training iteration.

Definition at line 691 of file Solver.cs.

◆ Database

Returns the in-memory MyCaffeDatabase used.

Definition at line 309 of file Solver.cs.

◆ EnableBlobDebugging

bool MyCaffe.solvers.Solver< T >.EnableBlobDebugging
getset

When enabled, the OnTrainingIteration event is set extra debugging information describing the state of each Blob used by the Solver.

Definition at line 360 of file Solver.cs.

◆ EnableBreakOnFirstNaN

bool MyCaffe.solvers.Solver< T >.EnableBreakOnFirstNaN
getset

When enabled (requires EnableBlobDebugging = true), the Solver immediately stop training upon detecting the first NaN withing the training Net.

Definition at line 381 of file Solver.cs.

◆ EnableDetailedNanDetection

bool MyCaffe.solvers.Solver< T >.EnableDetailedNanDetection
getset

When enabled (requires EnableBlobDebugging = true), the detailed Nan (and Infinity) detection is perofmed on each blob when training Net.

IMPORTANT: The use of this setting is only recommended on TCC enabled drivers.

See also
NVIDIA Tesla Compute Cluster (TCC) Help

Definition at line 394 of file Solver.cs.

◆ EnableLayerDebugging

bool MyCaffe.solvers.Solver< T >.EnableLayerDebugging
getset

Enable/disable layer debugging which causes each layer to check for NAN/INF on each forward/backward pass and throw an exception when found.

This option dramatically slows down training and is only recommended during debugging.

Definition at line 372 of file Solver.cs.

◆ EnableSingleStep

bool MyCaffe.solvers.Solver< T >.EnableSingleStep
getset

When enabled (requires EnableBlobDebugging = true), the Solver only runs one training cycle.

Definition at line 403 of file Solver.cs.

◆ EnableTesting

bool MyCaffe.solvers.Solver< T >.EnableTesting
getset

When enabled, the training cycle calls TestAll periodically based on the SolverParameter. Otherwise testing is not performed.

Definition at line 351 of file Solver.cs.

◆ forceSnapshot

bool MyCaffe.solvers.Solver< T >.forceSnapshot
getprotected

Returns whether or not a snapshot has been forced.

Definition at line 1260 of file Solver.cs.

◆ forceTest

bool MyCaffe.solvers.Solver< T >.forceTest
get

Returns whether or not a test has been forced.

Definition at line 1274 of file Solver.cs.

◆ is_root_solver

bool? MyCaffe.solvers.Solver< T >.is_root_solver
get

Returns whether or not this is the root solver.

The root solver has rank = 0.

Definition at line 1308 of file Solver.cs.

◆ iter

int MyCaffe.solvers.Solver< T >.iter
get

Returns the current training iteration.

Definition at line 1244 of file Solver.cs.

◆ LabelQueryEpochs

string MyCaffe.solvers.Solver< T >.LabelQueryEpochs
get

Return the label query epochs for the active datasource.

Definition at line 683 of file Solver.cs.

◆ LabelQueryHitPercents

string MyCaffe.solvers.Solver< T >.LabelQueryHitPercents
get

Return the label query hit percentages for the active datasource.

Definition at line 675 of file Solver.cs.

◆ LearningRateOverride

double MyCaffe.solvers.Solver< T >.LearningRateOverride
getset

Get/set the learning rate override. When 0, this setting is ignored.

Definition at line 226 of file Solver.cs.

◆ MaximumIteration

int MyCaffe.solvers.Solver< T >.MaximumIteration
get

Returns the maximum training iterations.

Definition at line 699 of file Solver.cs.

◆ net

Net<T> MyCaffe.solvers.Solver< T >.net
get

Returns the main training Net.

Definition at line 1228 of file Solver.cs.

◆ parameter

Returns the SolverParameter used.

Definition at line 1220 of file Solver.cs.

◆ smoothed_loss

double MyCaffe.solvers.Solver< T >.smoothed_loss
get

Returns the smoothed loss.

Definition at line 1212 of file Solver.cs.

◆ SnapshotWeightUpdateMethod

SNAPSHOT_WEIGHT_UPDATE_METHOD MyCaffe.solvers.Solver< T >.SnapshotWeightUpdateMethod
getset

Get/set the snapshot weight update method.

Definition at line 300 of file Solver.cs.

◆ solver_count

int MyCaffe.solvers.Solver< T >.solver_count
get

Returns the solver count in a multi-GPU session.

Definition at line 1289 of file Solver.cs.

◆ solver_rank

int MyCaffe.solvers.Solver< T >.solver_rank
get

Returns this Solver's rank in a multi-GPU session.

Definition at line 1297 of file Solver.cs.

◆ Tag

object MyCaffe.solvers.Solver< T >.Tag
getset

Returns a generic tag associated with the Solver.

Definition at line 421 of file Solver.cs.

◆ test_nets

List<Net<T> > MyCaffe.solvers.Solver< T >.test_nets
get

Returns the testing Nets.

Definition at line 1236 of file Solver.cs.

◆ TestingIterationOverride

int MyCaffe.solvers.Solver< T >.TestingIterationOverride
getset

Get/set the testing iteration override.

Definition at line 1187 of file Solver.cs.

◆ TestingIterations

int? MyCaffe.solvers.Solver< T >.TestingIterations
get

Returns the current testing iterations remaining.

Definition at line 723 of file Solver.cs.

◆ TestingNet

Net<T> MyCaffe.solvers.Solver< T >.TestingNet
get

Returns the testing Net used by the solver.

Definition at line 430 of file Solver.cs.

◆ TrainingIterationOverride

int MyCaffe.solvers.Solver< T >.TrainingIterationOverride
getset

Get/set the training iteration override.

Definition at line 1178 of file Solver.cs.

◆ TrainingIterations

int MyCaffe.solvers.Solver< T >.TrainingIterations
get

Returns the current training iterations remaining.

Definition at line 707 of file Solver.cs.

◆ TrainingNet

Net<T> MyCaffe.solvers.Solver< T >.TrainingNet
get

Returns the training Net used by the solver.

Definition at line 444 of file Solver.cs.

◆ TrainingTimeLimitInMinutes

int MyCaffe.solvers.Solver< T >.TrainingTimeLimitInMinutes
getset

Get/set the training time limit in minutes. When set to 0, no time limit is imposed on training.

Definition at line 291 of file Solver.cs.

◆ type

Returns the type of solver.

Definition at line 1252 of file Solver.cs.

◆ WeightsUpdated

bool MyCaffe.solvers.Solver< T >.WeightsUpdated
getset

Get/set when the weights have been updated.

Definition at line 412 of file Solver.cs.

Event Documentation

◆ OnAborted

EventHandler MyCaffe.solvers.Solver< T >.OnAborted

The OnAborted event fires after aborting a training cycle.

Definition at line 122 of file Solver.cs.

◆ OnCustomForwardBack

EventHandler<CustomForwardBackArgs<T> > MyCaffe.solvers.Solver< T >.OnCustomForwardBack

The OnCustomForwardBack allows for overriding the forward/backward operations within the solver.

Definition at line 155 of file Solver.cs.

◆ OnGetWorkspace

EventHandler<WorkspaceArgs> MyCaffe.solvers.Solver< T >.OnGetWorkspace

Specifies the OnGetWorkspace event that fires when the getWorkspace() function is called by a layer to get a shareable workspace to conserve GPU memory.

Definition at line 159 of file Solver.cs.

◆ OnGradientsReady

EventHandler<GradientsReadyArgs> MyCaffe.solvers.Solver< T >.OnGradientsReady

The OnGradientsReady event fires after the gradients of a Solver are ready for distribution to other Solvers in a multi-GPU training session.

Definition at line 126 of file Solver.cs.

◆ OnSetWorkspace

EventHandler<WorkspaceArgs> MyCaffe.solvers.Solver< T >.OnSetWorkspace

Specifies the OnSetWorkspace event that fires when the setWorkspace() function is called by a layer to get a shareable workspace to conserve GPU memory.

Definition at line 163 of file Solver.cs.

◆ OnSnapshot

EventHandler<SnapshotArgs> MyCaffe.solvers.Solver< T >.OnSnapshot

The OnSnapshot event fires when the Solver detects that a snapshot is needed.

Definition at line 130 of file Solver.cs.

◆ OnStart

EventHandler MyCaffe.solvers.Solver< T >.OnStart

The OnStart event fires at the start of each training iteration.

Definition at line 118 of file Solver.cs.

◆ OnTest

EventHandler<TestArgs> MyCaffe.solvers.Solver< T >.OnTest

When specified, the OnTest event fires during a TestAll and overrides the call to Test.

Definition at line 146 of file Solver.cs.

◆ OnTestingIteration

EventHandler<TestingIterationArgs<T> > MyCaffe.solvers.Solver< T >.OnTestingIteration

The OnTestingIteration event fires at the end of each testing iteration.

Definition at line 138 of file Solver.cs.

◆ OnTestResults

EventHandler<TestResultArgs<T> > MyCaffe.solvers.Solver< T >.OnTestResults

When specified, the OnTestResults event fires after each single test run. The recipient is responsible for setting the accuracy.

Definition at line 142 of file Solver.cs.

◆ OnTestStart

EventHandler MyCaffe.solvers.Solver< T >.OnTestStart

The OnTestStart event fires at the start of each testing iteration.

Definition at line 150 of file Solver.cs.

◆ OnTrainingIteration

EventHandler<TrainingIterationArgs<T> > MyCaffe.solvers.Solver< T >.OnTrainingIteration

The OnTrainingIteration event fires at the end of each training iteration.

Definition at line 134 of file Solver.cs.


The documentation for this class was generated from the following file: