MyCaffe  1.11.7.7
Deep learning software for Windows C# programmers.
MyCaffe.common.BlobCollection< T > Class Template Reference

The BlobCollection contains a list of Blobs. More...

Inheritance diagram for MyCaffe.common.BlobCollection< T >:

Public Member Functions

 BlobCollection ()
 The BlobCollection constructor. More...
 
Blob< T > FindBlob (string strName)
 Finds a given blob in the collection based on its name. More...
 
void Insert (int nIdx, Blob< T > b)
 Insert a blob at the given index. More...
 
void Add (Blob< T > b)
 Add a new Blob to the collection. More...
 
void Add (BlobCollection< T > rg)
 Add another BlobCollection to this one. More...
 
bool Remove (Blob< T > b)
 If it exists, remove a Blob from the collection. More...
 
void RemoveAt (int nIdx)
 Remove a Blob at a given index in the collection. More...
 
void Clear (bool bDispose=false)
 Remove all items from the collection. More...
 
bool Contains (Blob< T > blob)
 Returns whether or not the collection contains a given blob. More...
 
BlobCollection< T > FindRelatedBlobs (Blob< T > b)
 Find all Blobs in the collection that contain (in part or in whole) the name of a given Blob. More...
 
IEnumerator< Blob< T > > GetEnumerator ()
 Get the enumerator for the collection. More...
 
BlobCollection< T > Clone ()
 Copy the collection and return it as a new collection. More...
 
void ReshapeLike (BlobCollection< T > src)
 Reshapes all blobs in the collection to the sizes of the source. More...
 
void CopyFrom (BlobCollection< T > bSrc, bool bCopyDiff=false)
 Copy the data or diff from another BlobCollection into this one. More...
 
void Accumulate (CudaDnn< T > cuda, BlobCollection< T > src, bool bAccumulateDiff)
 Accumulate the diffs from one BlobCollection into another. More...
 
void SetDiff (double df)
 Set all blob diff to the value specified. More...
 
void SetData (double df)
 Set all blob data to the value specified. More...
 
BlobCollection< T > MathSub (BlobCollection< T > col, bool bSkipFirstItem)
 Create a new collection of cloned Blobs created by calling MathSub to subtract the Blobs in this collection from another collection. More...
 
BlobCollection< T > MathAdd (BlobCollection< T > colA, double dfScale, bool bSkipFirstItem)
 Create a new collection of cloned Blobs created by calling MathAdd to add the Blobs in this collection to another collection. More...
 
BlobCollection< T > MathDiv (double dfVal, bool bSkipFirstItem)
 Create a new collection of cloned Blobs created by calling MathDif to divide the Blobs in this collection with a scalar. More...
 
void Save (BinaryWriter bw, bool bData, bool bDiff)
 Save the collection to a binary writer. More...
 
bool Share (Blob< T > b, List< int > rgMinShape, bool bThrowExceptions)
 Share the first Blob found with the same name as the given Blob. More...
 
bool SnapshotRequested (bool bReset)
 Returns whether or not any blobs have a snapshot request set to true. More...
 
void Dispose ()
 Release all resource used by the collection and its Blobs. More...
 

Static Public Member Functions

static BlobCollection< T > Load (CudaDnn< T > cuda, Log log, BinaryReader br, bool bData, bool bDiff)
 Loads a new collection from a binary reader. More...
 

Properties

int Count [get]
 Returns the number of items in the collection. More...
 
Blob< T > this[int nIdx] [getset]
 Get/set an item within the collection at a given index. More...
 
Blob< T > this[string strName] [get]
 Get the item with the specified name, or throw an exception if not found. More...
 

Detailed Description

The BlobCollection contains a list of Blobs.

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

Definition at line 14 of file BlobCollection.cs.

Constructor & Destructor Documentation

◆ BlobCollection()

The BlobCollection constructor.

Definition at line 21 of file BlobCollection.cs.

Member Function Documentation

◆ Accumulate()

void MyCaffe.common.BlobCollection< T >.Accumulate ( CudaDnn< T >  cuda,
BlobCollection< T >  src,
bool  bAccumulateDiff 
)

Accumulate the diffs from one BlobCollection into another.

Parameters
cudaSpecifies the CudaDnn instance used to add the blobs into this collection.
srcSpecifies the source BlobCollection to add into this one.
bAccumulateDiffSpecifies to accumulate diffs when true, and the data otherwise.

Definition at line 240 of file BlobCollection.cs.

◆ Add() [1/2]

void MyCaffe.common.BlobCollection< T >.Add ( Blob< T >  b)

Add a new Blob to the collection.

Parameters
bSpecifies the Blob to add.

Definition at line 91 of file BlobCollection.cs.

◆ Add() [2/2]

void MyCaffe.common.BlobCollection< T >.Add ( BlobCollection< T >  rg)

Add another BlobCollection to this one.

Parameters
rgSpecifies the blob collection to add.

Definition at line 100 of file BlobCollection.cs.

◆ Clear()

void MyCaffe.common.BlobCollection< T >.Clear ( bool  bDispose = false)

Remove all items from the collection.

Parameters
bDisposeOptionally, call Dispose on each item removed.

Definition at line 131 of file BlobCollection.cs.

◆ Clone()

Copy the collection and return it as a new collection.

Returns
The new collection is returned.

Definition at line 194 of file BlobCollection.cs.

◆ Contains()

bool MyCaffe.common.BlobCollection< T >.Contains ( Blob< T >  blob)

Returns whether or not the collection contains a given blob.

Parameters
blobSpecifies the blob to look for.
Returns
If the blob is in the collection, true is returned, otherwise false is returned.

Definition at line 149 of file BlobCollection.cs.

◆ CopyFrom()

void MyCaffe.common.BlobCollection< T >.CopyFrom ( BlobCollection< T >  bSrc,
bool  bCopyDiff = false 
)

Copy the data or diff from another BlobCollection into this one.

Parameters
bSrcSpecifies the src BlobCollection to copy.
bCopyDiffOptionally, specifies to copy the diff instead of the data (default = false).

Definition at line 223 of file BlobCollection.cs.

◆ Dispose()

void MyCaffe.common.BlobCollection< T >.Dispose ( )

Release all resource used by the collection and its Blobs.

Definition at line 466 of file BlobCollection.cs.

◆ FindBlob()

Blob< T > MyCaffe.common.BlobCollection< T >.FindBlob ( string  strName)

Finds a given blob in the collection based on its name.

Parameters
strNameSpecifies the name of the blob to find.
Returns
If found, the blob is returned, othweriwse null is returned.

Definition at line 66 of file BlobCollection.cs.

◆ FindRelatedBlobs()

BlobCollection< T > MyCaffe.common.BlobCollection< T >.FindRelatedBlobs ( Blob< T >  b)

Find all Blobs in the collection that contain (in part or in whole) the name of a given Blob.

Parameters
bSpecifies the Blob to look for.
Returns
A new collection of all Blobs that match are returned.

Definition at line 159 of file BlobCollection.cs.

◆ GetEnumerator()

IEnumerator< Blob< T > > MyCaffe.common.BlobCollection< T >.GetEnumerator ( )

Get the enumerator for the collection.

Returns
The enumerator is returned.

Definition at line 176 of file BlobCollection.cs.

◆ Insert()

void MyCaffe.common.BlobCollection< T >.Insert ( int  nIdx,
Blob< T >  b 
)

Insert a blob at the given index.

Parameters
nIdxSpecifies the index where the blob should be added.
bSpecifies the blob to add.

Definition at line 82 of file BlobCollection.cs.

◆ Load()

static BlobCollection< T > MyCaffe.common.BlobCollection< T >.Load ( CudaDnn< T >  cuda,
Log  log,
BinaryReader  br,
bool  bData,
bool  bDiff 
)
static

Loads a new collection from a binary reader.

Parameters
cudaSpecifies the instance of CudaDnn to use for the Cuda connection.
logSpecifies the Log to use for output.
brSpecifies the binary reader.
bDataSpecifies whether or not to read the data.
bDiffSpecifies whether or not to read the diff.
Returns

Definition at line 385 of file BlobCollection.cs.

◆ MathAdd()

BlobCollection< T > MyCaffe.common.BlobCollection< T >.MathAdd ( BlobCollection< T >  colA,
double  dfScale,
bool  bSkipFirstItem 
)

Create a new collection of cloned Blobs created by calling MathAdd to add the Blobs in this collection to another collection.

Calculation: Y = Clone(colA) * dfScale + this

Parameters
colASpecifies the collection that will be cloned.
dfScaleSpecifies the scale that will be applied to the clone of this collection
bSkipFirstItemSpecifies whether or not to skip the first item.
Returns

Definition at line 323 of file BlobCollection.cs.

◆ MathDiv()

BlobCollection< T > MyCaffe.common.BlobCollection< T >.MathDiv ( double  dfVal,
bool  bSkipFirstItem 
)

Create a new collection of cloned Blobs created by calling MathDif to divide the Blobs in this collection with a scalar.

Parameters
dfValSpecifies the divisor.
bSkipFirstItemSpecifies whether or not to skip the first item.
Returns

Definition at line 346 of file BlobCollection.cs.

◆ MathSub()

BlobCollection< T > MyCaffe.common.BlobCollection< T >.MathSub ( BlobCollection< T >  col,
bool  bSkipFirstItem 
)

Create a new collection of cloned Blobs created by calling MathSub to subtract the Blobs in this collection from another collection.

Calculation: Y = Clone(colA) - this

Parameters
colSpecifies the collection that this collection will be subtracted from.
bSkipFirstItemSpecifies whether or not to skip the first item.
Returns

Definition at line 297 of file BlobCollection.cs.

◆ Remove()

bool MyCaffe.common.BlobCollection< T >.Remove ( Blob< T >  b)

If it exists, remove a Blob from the collection.

Parameters
bSpecifies the Blob.
Returns
If the Blob is found and removed, true is returned, otherwise false is returned.

Definition at line 113 of file BlobCollection.cs.

◆ RemoveAt()

void MyCaffe.common.BlobCollection< T >.RemoveAt ( int  nIdx)

Remove a Blob at a given index in the collection.

Parameters
nIdxSpecifies the index.

Definition at line 122 of file BlobCollection.cs.

◆ ReshapeLike()

void MyCaffe.common.BlobCollection< T >.ReshapeLike ( BlobCollection< T >  src)

Reshapes all blobs in the collection to the sizes of the source.

Parameters
srcSpecifies the source collection to reshape to.

Definition at line 210 of file BlobCollection.cs.

◆ Save()

void MyCaffe.common.BlobCollection< T >.Save ( BinaryWriter  bw,
bool  bData,
bool  bDiff 
)

Save the collection to a binary writer.

Parameters
bwSpecifies the binary writer.
bDataSpecifies whether or not to save the data.
bDiffSpecifies whether or not to save the diff.

Definition at line 366 of file BlobCollection.cs.

◆ SetData()

void MyCaffe.common.BlobCollection< T >.SetData ( double  df)

Set all blob data to the value specified.

Parameters
dfSpecifies the value to set all blob data to.

Definition at line 280 of file BlobCollection.cs.

◆ SetDiff()

void MyCaffe.common.BlobCollection< T >.SetDiff ( double  df)

Set all blob diff to the value specified.

Parameters
dfSpecifies the value to set all blob diff to.

Definition at line 268 of file BlobCollection.cs.

◆ Share()

bool MyCaffe.common.BlobCollection< T >.Share ( Blob< T >  b,
List< int >  rgMinShape,
bool  bThrowExceptions 
)

Share the first Blob found with the same name as the given Blob.

Parameters
bSpecifies the Blob that will share the found Blob.
rgMinShapeSpecifies the minimum shape required to share.
bThrowExceptionsSpecifies whether or not th throw an Exception if the sizes do not match.
Returns

Definition at line 405 of file BlobCollection.cs.

◆ SnapshotRequested()

bool MyCaffe.common.BlobCollection< T >.SnapshotRequested ( bool  bReset)

Returns whether or not any blobs have a snapshot request set to true.

Returns
If any blob in the colleciton has their snapshot request set to true, then true is returned.

Definition at line 445 of file BlobCollection.cs.

Property Documentation

◆ Count

int MyCaffe.common.BlobCollection< T >.Count
get

Returns the number of items in the collection.

Definition at line 28 of file BlobCollection.cs.

◆ this[int nIdx]

Blob<T> MyCaffe.common.BlobCollection< T >.this[int nIdx]
getset

Get/set an item within the collection at a given index.

Parameters
nIdxSpecifies the index of the item to access.
Returns
The item at the index is returned.

Definition at line 38 of file BlobCollection.cs.

◆ this[string strName]

Blob<T> MyCaffe.common.BlobCollection< T >.this[string strName]
get

Get the item with the specified name, or throw an exception if not found.

Parameters
strNameSpecifies the name of the blob to find.
Returns
The blob with the matching name is returned.

Definition at line 49 of file BlobCollection.cs.


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