MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.common.IXPersist< T > Interface Template Reference

The IXPersist interface is used by the CaffeControl to load and save weights. More...

Inheritance diagram for MyCaffe.common.IXPersist< T >:
MyCaffe.common.PersistCaffe< T >

Public Member Functions

byte[] SaveWeights (BlobCollection< T > colBlobs, bool bSaveDiffs=false)
 Save the weights to a byte array. More...
 
BlobCollection< T > LoadWeights (byte[] rgWeights, List< string > rgExpectedShapes, BlobCollection< T > colBlobs, bool bSizeToFit, out bool bLoadedDiffs, List< string > inputWtInfo=null, List< string > targetWtInfo=null, string strSkipBlobType=null)
 Loads new weights into a BlobCollection More...
 
byte[] SaveSolverState (SolverState state, SolverParameter.SolverType type=SolverParameter.SolverType.SGD)
 Save the solver state to a byte array. More...
 
SolverState LoadSolverState (byte[] rgState, SolverParameter.SolverType type=SolverParameter.SolverType.SGD)
 Load the solver state from a byte array. More...
 
WeightInfo< T > LoadWeightInfo (byte[] rgWeights)
 Returns the weight information describing the weights containined within the weight bytes. More...
 
WeightInfo< T > LoadWeightInfo (BlobCollection< T > colBlobs)
 Returns the weight information describing the weights containined within the Blob collection. More...
 

Detailed Description

The IXPersist interface is used by the CaffeControl to load and save weights.

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

Definition at line 186 of file Interfaces.cs.

Member Function Documentation

◆ LoadSolverState()

SolverState MyCaffe.common.IXPersist< T >.LoadSolverState ( byte[]  rgState,
SolverParameter.SolverType  type = SolverParameter.SolverType.SGD 
)

Load the solver state from a byte array.

Parameters
rgStateSpecifies the byte array containing the solver state.
typeSpecifies the solver type.
Returns
The SolverState loaded is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.

◆ LoadWeightInfo() [1/2]

WeightInfo< T > MyCaffe.common.IXPersist< T >.LoadWeightInfo ( BlobCollection< T >  colBlobs)

Returns the weight information describing the weights containined within the Blob collection.

Parameters
colBlobsSpecifies the Blob collection containing the weights.
Returns
The weight information is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.

◆ LoadWeightInfo() [2/2]

WeightInfo< T > MyCaffe.common.IXPersist< T >.LoadWeightInfo ( byte[]  rgWeights)

Returns the weight information describing the weights containined within the weight bytes.

Parameters
rgWeightsSpecifies the bytes containing the weights.
Returns
The weight information is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.

◆ LoadWeights()

BlobCollection< T > MyCaffe.common.IXPersist< T >.LoadWeights ( byte[]  rgWeights,
List< string >  rgExpectedShapes,
BlobCollection< T >  colBlobs,
bool  bSizeToFit,
out bool  bLoadedDiffs,
List< string >  inputWtInfo = null,
List< string >  targetWtInfo = null,
string  strSkipBlobType = null 
)

Loads new weights into a BlobCollection

NOTE: In order to maintain compatibility with the C++ Caffe, extra MyCaffe features may be added to the end of the weight file. After saving weights (see SaveWeights) in the format used by the C++ Caffe, MyCaffe writes the bytes "mycaffe.ai". All information after these bytes are specific to MyCaffe and allow for loading weights for models by Blob name and shape and loosen the C++ Caffe requirement that the 'number' of blobs match. Adding this functionality allows for training model, changing the model structure, and then re-using the trained weights in the new model.

Parameters
rgWeightsSpecifies the weights themselves.
rgExpectedShapesSpecifies a list of expected shapes for each Blob where the weights are to be loaded.
colBlobsSpecifies the Blobs to load with the weights.
bSizeToFitOptionally, specifies wether or not the weights should be re-sized. Note: resizing can render the weights useless, especially in deeper, layers.
bLoadedDiffsReturns whether or not the diffs were loaded.
inputWtInfoOptionally, specifies the weight info describing the input weight blobs to import by name. Note when used the number of blobs must match the number of targetWtInfo blobs. Otherwise, when null this parameter is ignored.
targetWtInfoOptionally, specifies the weight info describing the target weight blobs to import by name. Note when used the number of blobs must match the number of inputWtInfo blobs. Otherwise, when null this parameter is ignored.
strSkipBlobTypeOptionally, specifies a blob type where weights are NOT loaded. See Blob.BLOB_TYPE for the types of Blobs.
Returns
The collection of Blobs with newly loaded weights is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.

◆ SaveSolverState()

byte[] MyCaffe.common.IXPersist< T >.SaveSolverState ( SolverState  state,
SolverParameter.SolverType  type = SolverParameter.SolverType.SGD 
)

Save the solver state to a byte array.

Parameters
stateSpecifies the solver state to save.
typeSpecifies the solver type.
Returns
A byte array containing the solver state is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.

◆ SaveWeights()

byte[] MyCaffe.common.IXPersist< T >.SaveWeights ( BlobCollection< T >  colBlobs,
bool  bSaveDiffs = false 
)

Save the weights to a byte array.

NOTE: In order to maintain compatibility with the C++ Caffe, extra MyCaffe features may be added to the end of the weight file. After saving weights in the format used by the C++ Caffe, MyCaffe writes the bytes "mycaffe.ai". All information after these bytes are specific to MyCaffe and allow for loading weights for models by Blob name and shape and loosen the C++ Caffe requirement that the 'number' of blobs match. Adding this functionality allows for training model, changing the model structure, and then re-using the trained weights in the new model.

Parameters
colBlobsSpecifies the Blobs to save with the weights.
bSaveDiffsOptionally, specifies to save the diff values.
Returns
The byte array containing the weights is returned.

Implemented in MyCaffe.common.PersistCaffe< T >.


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