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

The Blob is the main holder of data that moves through the Layers of the Net. More...

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

Public Member Functions

 Blob (CudaDnn< T > cuda, Log log, bool bIncludeDiff=true, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (CudaDnn< T > cuda, Log log, int nNum, int nChannels, int nHeight, int nWidth, bool bIncludeDiff=true, bool bUseHalfSize=false)
 DEPRECIATED; use More...
 
 Blob (CudaDnn< T > cuda, Log log, List< int > rgShape, bool bIncludeDiff=true, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (CudaDnn< T > cuda, Log log, int[] rgShape, bool bIncludeDiff=true, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (CudaDnn< T > cuda, Log log, Blob< T > b, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (CudaDnn< T > cuda, Log log, SimpleDatum d, bool bCopyData=false, bool bIncludeDiff=true, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (CudaDnn< T > cuda, Log log, BlobProto bp, bool bUseHalfSize=false)
 The Blob constructor. More...
 
 Blob (Blob< T > blob, long lCount, long lOffset)
 The Blob constructor used to copy another blob by creating memory pointers to its data thus sharing the same GPU memory. More...
 
ulong GetConversionWorkSize (bool bUseHalfSize)
 Returns the amount of memory (in bytes) required to convert from base to half and back. More...
 
void ConvertToHalf (long hWorkMem, ulong lWorkSize, bool bData, bool bDiff)
 Converts this blob from its base type to the half type. More...
 
void ConvertToBase (long hWorkMem, ulong lWorkSize, bool bData, bool bDiff)
 Converts this blob from the half type to the base type. More...
 
void Dispose ()
 Releases all resources used by the Blob (including both GPU and Host). More...
 
void Reshape (int nNum, int nChannels, int nHeight, int nWidth, bool? bUseHalfSize=null)
 DEPRECIATED; use More...
 
void Reshape (List< int > rgShape, bool? bUseHalfSize=null)
 Change the dimensions of the blob, allocating new memory if necessary. More...
 
void Reshape (int[] rgShape, bool? bUseHalfSize=null)
 Change the dimensions of the blob, allocating new memory if necessary. More...
 
void Reshape (BlobShape shape, bool? bUseHalfSize=null)
 Change the dimensions of the blob, allocating new memory if necessary. More...
 
void ReshapeLike (Blob< T > b, bool? bUseHalfSize=null)
 Reshape this Blob to have the same shape as another Blob. More...
 
List< int > shape ()
 Returns an array where each element contains the shape of an axis of the Blob. More...
 
int shape (int nIdx)
 Returns the dimension of the nIdx'th axis (or the negative nIdx'th axis from teh end, if nIdx is negative. More...
 
int count ()
 Returns the total number of items in the Blob. More...
 
int count (int nStartIdx, int nEndIdx)
 Compute the volume of a slice; i.e., the product of dimensions among a range of axes. More...
 
int count (int nStartIdx)
 Compute the volume of a slice spanning from a particular first axis to the final axis. More...
 
int CanonicalAxisIndex (int nIdx)
 Returns the 'canonical' version of a (usually) user-specified axis, allowing for negative indexing (e.g., -1 for the last axis). More...
 
int LegacyShape (int nIdx)
 Returns the legacy shape at a given axis. More...
 
int offset (int n, int c=0, int h=0, int w=0)
 Returns the flat offset given the number, channel, height and width. More...
 
int offset (List< int > rgIdx)
 Returns the flat offset given the array of axes values. More...
 
void CopyFrom (Blob< T > src, int nSrcOffset, int nDstOffset, int nCount, bool bCopyData, bool bCopyDiff)
 Copy from a source Blob. More...
 
long CopyFrom (Blob< T > src, bool bCopyDiff=false, bool bReshape=false, long hDstHostBuffer=0, bool bIgnoreShape=false)
 Copy from a source Blob. More...
 
void CopyFromAndTransposeHeightWidth (Blob< T > blobSrc, bool bCopyDiff=false)
 Copy from a source Blob and transpose the height and width of the copy. More...
 
void CopyFrom (Blob< T > blobSrc, int nChannelFrom, int nChannelTo, bool bCopyDiff=false)
 Copy all data along a given channel from the source. More...
 
data_at (int n, int c, int h, int w)
 Returns the data at a given location in the Blob. More...
 
diff_at (int n, int c, int h, int w)
 Returns the diff at a given location in the Blob. More...
 
data_at (List< int > rgIdx)
 Returns the data at a given location in the Blob. More...
 
diff_at (List< int > rgIdx)
 Returns the diff at a given location in the Blob. More...
 
T[] update_cpu_data ()
 Update the CPU data by transferring the GPU data over to the Host. More...
 
T[] update_cpu_diff ()
 Update the CPU diff by transferring the GPU diff over to the Host. More...
 
void Update ()
 The 'update' method is used for parameter blobs in a Net. More...
 
void FromProto (BlobProto bp, bool bReshape=true)
 Create a new Blob from a given BlobProto. More...
 
BlobProto ToProto (bool bWriteDiff=false)
 Writes the Blob to a new BlobProto. More...
 
asum_data ()
 Compute the sum of absolute values (L1 norm) of the data. More...
 
asum_diff ()
 Compute the sum of absolute values (L1 norm) of the diff. More...
 
sumsq_data ()
 Calcualte the sum of squares (L2 norm squared) of the data. More...
 
sumsq_diff ()
 Calcualte the sum of squares (L2 norm squared) of the diff. More...
 
void scale_data (double df)
 Scale the data by a scaling factor. More...
 
void scale_diff (double df)
 Scale the diff by a scaling factor. More...
 
void scale_to_range (double dfMin, double dfMax)
 Scale the data in the blob to the range [dfMin,dfMax]. More...
 
void scale_data (T fScaleFactor)
 Scale the blob data by a constant factor. More...
 
void scale_diff (T fScaleFactor)
 Scale the blob diff by a constant factor. More...
 
void ShareData (Blob< T > b)
 Set the data to point to the data of the other blob – useful in Layers which simply perform a copy in their forward pass. More...
 
void ShareDiff (Blob< T > b)
 Set the diff to point to the diff of the other blob – useful in Layers which simply perform a copy in their forward pass. More...
 
void Share (Blob< T > b)
 Share another Blob with this one, by setting the data and diff to the same data and diff of the other Blob. More...
 
GetData (int nIdx)
 Returns the data at a given flat index within the Blob. More...
 
GetDiff (int nIdx)
 Returns the diff at a given flat index within the Blob. More...
 
void SetData (T[] rgData, int nCount=-1, bool bSetCount=true)
 Sets a number of items within the Blob's data. More...
 
void SetData (T fVal, int nIdx=-1)
 Either sets all of the data items in the Blob to a given value, or alternatively only sets a single indexed item to a given value. More...
 
void SetData (double dfVal, int nIdx=-1)
 Either sets all of the data items in the Blob to a given value, or alternatively only sets a single indexed item to a given value. More...
 
void SetData (double dfVal, int nStartIdx, int nCount)
 Set a data range with a given value. More...
 
void SetDiff (double dfVal, int nIdx=-1)
 Either sets all of the diff items in the Blob to a given value, or alternatively only sets a single indexed item to a given value. More...
 
void SetDiff (double dfVal, int nStartIdx, int nCount)
 Set a diff range with a given value. More...
 
void SetDiff (T[] rgDiff, int nCount=-1, bool bSetCount=true)
 Sets a number of items within the Blob's diff. More...
 
void SetData (SimpleDatum d, bool bReshape, bool bCopyData=true)
 Sets the Blob values to the data contained within a SimpleDatum. More...
 
void SetCPUData (T[] rg)
 Sets just the CPU data to the data specified. More...
 
void AsyncGpuPush (long hStream)
 Asynchronously pushes the CPU data, previously set with SetCPUData, to the GPU. More...
 
bool ShapeEquals (BlobProto bp)
 Compares the shape of this blob to the shape within a BlobProto. More...
 
bool CompareShape (List< int > rgShape)
 Compares the shape of this blob to another shape. More...
 
string ToSizeString ()
 Returns a string describing the 4D shape of the Blob. More...
 
Datum ToDatum ()
 Returns a new Datum that contains the shape and data of the Blob. More...
 
Blob< T > Clone ()
 Copies the Blob, including its data and diff. More...
 
Blob< T > MathAdd (Blob< T > blobA, T fScale)
 Clones the input Blob, scales the clone and then adds the data from this Blob to it. More...
 
Blob< T > MathSub (Blob< T > blobA)
 Clones the input Blob and subtracts the data from this blob from it. More...
 
Blob< T > MathDiv (T fScale)
 Clones the input Blob and divides a scalar from all of the clones data items. More...
 
void Save (BinaryWriter bw, bool bData, bool bDiff)
 Saves this Blob to a binary stream. More...
 
override string ToString ()
 Returns a string representation of the Blob. More...
 
string ToString (int nMax, bool bDiff=false)
 Get the string representation containing up to the first 'nMax' items. More...
 
double GetMinData (out long lPos)
 Returns the minimum data and the position where the minimum is located in the data. More...
 
double GetMaxData (out long lPos)
 Returns the maximum data and the position where the maximum is located in the data. More...
 
double GetMinDiff (out long lPos)
 Returns the minimum diff and the position where the minimum is located in the diff. More...
 
double GetMaxDiff (out long lPos)
 Returns the maximum diff and the position where the maximum is located in the diff. More...
 
Tuple< double, double, double, double > minmax_data (Blob< T > work, bool bDetectNans=false, bool bUseChunks=false)
 Returns the minimum and maximum values in the data of the Blob. More...
 
Tuple< double, double, double, double > minmax_diff (Blob< T > work, bool bDetectNans=false, bool bUseChunks=false)
 Returns the minimum and maximum values in the diff of the Blob. More...
 
void add_scalar (double dfVal)
 Adds a scalar value to the Blob. More...
 
Blob< T > Resize (List< int > rgShape)
 The Resize method resizes the 3rd and 4th axes of the blob. More...
 
void NormalizeData (double? dfMean=null, double? dfStd=null)
 Normalize the blob data by subtracting the mean and dividing by the standard deviation. More...
 
double mean (float[] rgDf=null, bool bDiff=false)
 Calculate the mean of the blob data. More...
 
double std (double? dfMean=null, float[] rgDf=null)
 Calculate the standard deviation of the blob data. More...
 
Tuple< T, T, T > SetPixel (int nX, int nY, byte R, byte G, byte B, TransformationParameter.COLOR_ORDER order=TransformationParameter.COLOR_ORDER.RGB)
 Set the values of a 3 channel image embedded within the blob in the order RGB or BGR where the full hxw is stored for each color in order. More...
 
Tuple< T, T, T > SetPixel (int nX, int nY, Tuple< T, T, T > pixel, bool bReturnOriginal=false, TransformationParameter.COLOR_ORDER order=TransformationParameter.COLOR_ORDER.RGB, int nOffset=0)
 Sets a pixel to the values within a three item tuple where the first item is assigned RED, second GREEN and third BLUE. More...
 

Static Public Member Functions

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

Static Public Attributes

const int MAX_BLOB_AXES = 32
 Defines the maximum number of Axes supported by the Blob. More...
 

Protected Member Functions

virtual void Dispose (bool bDisposing)
 Releases all resources used by the Blob (including both GPU and Host). More...
 

Properties

static T Zero [get]
 Returns Zero (0) in type T. More...
 
static T One [get]
 Returns One (1) in type T. More...
 
static T MinusOne [get]
 Returns MinusOne (-1) in type T. More...
 
bool Padded [getset]
 Get/set the padding state of the blob. More...
 
bool HalfSize [get]
 Returns whether or not this blob is using half sizes. More...
 
bool freeze_learning [getset]
 Specifies whether or not the diff is applied to the data during Update. When freeze learning = true, the update is skipped. More...
 
CudaDnn< T > Cuda [get]
 Returns the CudaDnn object that manages the Blob's memory."/> More...
 
Log Log [get]
 Returns the Log associated with the blob. More...
 
string shape_string [get]
 Returns a string describing the Blob's shape. More...
 
bool DiffExists [get]
 Returns whether or not the Diff portion exists. More...
 
int num_axes [get]
 Returns the number of axes in the Blob. More...
 
int num_true_axes [get]
 Returns the number of true axes, ignoring the trailing ones. More...
 
int num [get]
 DEPRECIATED; legacy shape accessor num: use shape(0) instead. More...
 
int channels [get]
 DEPRECIATED; legacy shape accessor channels: use shape(1) instead. More...
 
int height [get]
 DEPRECIATED; legacy shape accessor height: use shape(2) instead. More...
 
int width [get]
 DEPRECIATED; legacy shape accessor width: use shape(3) instead. More...
 
SyncedMemory< T > data [get]
 Returns the SyncedMemory that stores the data. More...
 
SyncedMemory< T > diff [get]
 Returns the SyncedMemory that stores the diff. More...
 
T[] cpu_data [get]
 Returns the last host data retrieved from the GPU. More...
 
T[] mutable_cpu_data [getset]
 Get data from the GPU and bring it over to the host, or Set data from the Host and send it over to the GPU. More...
 
long gpu_data [get]
 Returns the data GPU handle used by the CudaDnn connection. More...
 
long mutable_gpu_data [get]
 Returns the data GPU handle used by the CudaDnn connection. More...
 
T[] cpu_diff [get]
 Returns the last host diff retrieved from the GPU. More...
 
T[] mutable_cpu_diff [getset]
 Get diff from the GPU and bring it over to the host, or Set diff from the Host and send it over to the GPU. More...
 
long gpu_diff [get]
 Returns the diff GPU handle used by the CudaDnn connection. More...
 
long mutable_gpu_diff [get]
 Returns the diff GPU handle used by the CudaDnn connection. More...
 
long gpu_shape [get]
 Returns the shape GPU handle used by the CudaDnn connection. The shape data contains the shape information of the Blob for use in GPU operations. More...
 
bool reshape_when_sharing [getset]
 When true, this Blob is reshaped to the source when sharing the source data (default = false). More...
 
bool snapshot_requested [getset]
 Get/set the snapshot request. More...
 
string Name [getset]
 Get/set the name of the Blob. More...
 
double min_data [get]
 Returns the minimum value in the data of the Blob. More...
 
double max_data [get]
 Returns the maximum value in the data of the Blob. More...
 
double min_diff [get]
 Returns the minimum value in the diff of the Blob. More...
 
double max_diff [get]
 Returns the maximum value in the diff of the Blob. More...
 
BLOB_TYPE type [getset]
 Returns the BLOB_TYPE of the Blob. More...
 
object Tag [getset]
 Returns a user defined object associated with the Blob. More...
 

Detailed Description

The Blob is the main holder of data that moves through the Layers of the Net.

Each blob holds Data and optionally Diff where the data is passed through the Net Layers on each forward pass, and the Diff contains the errors passed backward throgh the Net Layers on the backward pass.

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

Definition at line 23 of file Blob.cs.

Constructor & Destructor Documentation

◆ Blob() [1/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
bool  bIncludeDiff = true,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
bIncludeDiffOptionally, specifies whether or not to include (and allocate) the Diff data.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 61 of file Blob.cs.

◆ Blob() [2/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
int  nNum,
int  nChannels,
int  nHeight,
int  nWidth,
bool  bIncludeDiff = true,
bool  bUseHalfSize = false 
)

DEPRECIATED; use

Blob(...,rgShape) instead.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
nNumSpecifies the number of inputs.
nChannelsSpecifies the number of channels per input.
nHeightSpecifies the height of each input.
nWidthSpecifies the width of each input.
bIncludeDiffOptionally, specifies whether or not to include (and allocate) the Diff data.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 95 of file Blob.cs.

◆ Blob() [3/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
List< int >  rgShape,
bool  bIncludeDiff = true,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
rgShapeSpecifies the shape of each axis of the Blob.
bIncludeDiffOptionally, specifies whether or not to include (and allocate) the Diff data.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 112 of file Blob.cs.

◆ Blob() [4/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
int[]  rgShape,
bool  bIncludeDiff = true,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
rgShapeSpecifies the shape of each axis of the Blob.
bIncludeDiffOptionally, specifies whether or not to include (and allocate) the Diff data.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 128 of file Blob.cs.

◆ Blob() [5/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
Blob< T >  b,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
bCreate this blob to be like another Blob (e.g. same shape).
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 143 of file Blob.cs.

◆ Blob() [6/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
SimpleDatum  d,
bool  bCopyData = false,
bool  bIncludeDiff = true,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
dSpecifies the datum for which the Blob is shaped to match.
bCopyDataOptionally, specifies whether or not to actually copy the data. When false, the shape is set, but no data is copied.
bIncludeDiffOptionally, specifies whether or not to include (and allocate) the Diff data.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 160 of file Blob.cs.

◆ Blob() [7/8]

MyCaffe.common.Blob< T >.Blob ( CudaDnn< T >  cuda,
Log  log,
BlobProto  bp,
bool  bUseHalfSize = false 
)

The Blob constructor.

Parameters
cudaSpecifies the CudaDnn instance used to communidate with Cuda.
logSpecifies the Log for output.
bpSpecifies the BlobProto used to load the Blob.
bUseHalfSizeOptionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'.

Definition at line 173 of file Blob.cs.

◆ Blob() [8/8]

MyCaffe.common.Blob< T >.Blob ( Blob< T >  blob,
long  lCount,
long  lOffset 
)

The Blob constructor used to copy another blob by creating memory pointers to its data thus sharing the same GPU memory.

Parameters
blobSpecifies the blob whos data is to be shared.
lCountSpecifies the number of items to share.
lOffsetSpecifies the offset into the blob where the shareing starts.

Definition at line 185 of file Blob.cs.

Member Function Documentation

◆ add_scalar()

void MyCaffe.common.Blob< T >.add_scalar ( double  dfVal)

Adds a scalar value to the Blob.

Parameters
dfValSpecifies the scalar value.

Definition at line 2394 of file Blob.cs.

◆ asum_data()

T MyCaffe.common.Blob< T >.asum_data ( )

Compute the sum of absolute values (L1 norm) of the data.

Returns

Definition at line 1431 of file Blob.cs.

◆ asum_diff()

T MyCaffe.common.Blob< T >.asum_diff ( )

Compute the sum of absolute values (L1 norm) of the diff.

Returns

Definition at line 1443 of file Blob.cs.

◆ AsyncGpuPush()

void MyCaffe.common.Blob< T >.AsyncGpuPush ( long  hStream)

Asynchronously pushes the CPU data, previously set with SetCPUData, to the GPU.

Parameters
hStreamSpecifies a handle to the Cuda Stream to use for synchronization.

Definition at line 1787 of file Blob.cs.

◆ CanonicalAxisIndex()

int MyCaffe.common.Blob< T >.CanonicalAxisIndex ( int  nIdx)

Returns the 'canonical' version of a (usually) user-specified axis, allowing for negative indexing (e.g., -1 for the last axis).

Parameters
nIdxThe axis index.
Returns
The zero based index is returned.

Definition at line 714 of file Blob.cs.

◆ Clone()

Blob< T > MyCaffe.common.Blob< T >.Clone ( )

Copies the Blob, including its data and diff.

Returns
A new copy of the Blob is returned.

Definition at line 1891 of file Blob.cs.

◆ CompareShape()

bool MyCaffe.common.Blob< T >.CompareShape ( List< int >  rgShape)

Compares the shape of this blob to another shape.

Parameters
rgShapeSpecifies the shape to compare with.
Returns
If the shapes are the same, return true, othewise false.

Definition at line 1832 of file Blob.cs.

◆ ConvertToBase()

void MyCaffe.common.Blob< T >.ConvertToBase ( long  hWorkMem,
ulong  lWorkSize,
bool  bData,
bool  bDiff 
)

Converts this blob from the half type to the base type.

Parameters
hWorkMemSpecifies the work memory.
lWorkSizeSpecifies the work size.
bDataSpecifies to convert the data.
bDiffSpecifies to convert the diff

Definition at line 277 of file Blob.cs.

◆ ConvertToHalf()

void MyCaffe.common.Blob< T >.ConvertToHalf ( long  hWorkMem,
ulong  lWorkSize,
bool  bData,
bool  bDiff 
)

Converts this blob from its base type to the half type.

Parameters
hWorkMemSpecifies the work memory.
lWorkSizeSpecifies the work size.
bDataSpecifies to convert the data.
bDiffSpecifies to convert the diff

Definition at line 244 of file Blob.cs.

◆ CopyFrom() [1/3]

void MyCaffe.common.Blob< T >.CopyFrom ( Blob< T >  blobSrc,
int  nChannelFrom,
int  nChannelTo,
bool  bCopyDiff = false 
)

Copy all data along a given channel from the source.

Parameters
blobSrcSpecifies the source blob to copy from.
nChannelFromSpecifies the channel within the source to copy from.
nChannelToSpecifies the channel in the destination (this blob) to copy into.
bCopyDiffSpecifies whether or not to copy the data or diff.

Definition at line 938 of file Blob.cs.

◆ CopyFrom() [2/3]

long MyCaffe.common.Blob< T >.CopyFrom ( Blob< T >  src,
bool  bCopyDiff = false,
bool  bReshape = false,
long  hDstHostBuffer = 0,
bool  bIgnoreShape = false 
)

Copy from a source Blob.

Parameters
srcThe Blob to copy from.
bCopyDiffIf false, copy the data; if true, copy the diff.
bReshapeIf false, require this Blob to be pre-shaped to the shape of other (and die otherwise); If true, Reshape this Blob to other's shape if necessary.
hDstHostBufferOptionally, specifies the host buffer of the destination.
bIgnoreShapeOptionally, specifies to ignore the shape and just make sure the count is the same before copying (default = false).
Returns
When used, the host buffer handle is returned.

Definition at line 862 of file Blob.cs.

◆ CopyFrom() [3/3]

void MyCaffe.common.Blob< T >.CopyFrom ( Blob< T >  src,
int  nSrcOffset,
int  nDstOffset,
int  nCount,
bool  bCopyData,
bool  bCopyDiff 
)

Copy from a source Blob.

Parameters
srcThe Blob to copy from.
nSrcOffsetThe offset into the source data to copy.
nDstOffsetThe offset into the destination data to copy.
nCountThe number of items to copy.
bCopyDataCopy the data.
bCopyDiffCopy the diff.

Definition at line 837 of file Blob.cs.

◆ CopyFromAndTransposeHeightWidth()

void MyCaffe.common.Blob< T >.CopyFromAndTransposeHeightWidth ( Blob< T >  blobSrc,
bool  bCopyDiff = false 
)

Copy from a source Blob and transpose the height and width of the copy.

Parameters
blobSrcThe Blob to copy from.
bCopyDiffIf false, copy the data; if true, copy the diff.

Definition at line 893 of file Blob.cs.

◆ count() [1/3]

int MyCaffe.common.Blob< T >.count ( )

Returns the total number of items in the Blob.

Returns

Definition at line 673 of file Blob.cs.

◆ count() [2/3]

int MyCaffe.common.Blob< T >.count ( int  nStartIdx)

Compute the volume of a slice spanning from a particular first axis to the final axis.

Parameters
nStartIdxThe first axis to include in the slice.
Returns

Definition at line 702 of file Blob.cs.

◆ count() [3/3]

int MyCaffe.common.Blob< T >.count ( int  nStartIdx,
int  nEndIdx 
)

Compute the volume of a slice; i.e., the product of dimensions among a range of axes.

Parameters
nStartIdxThe first axis to include in the slice.
nEndIdxThe first axis to exclude from the slice.
Returns

Definition at line 685 of file Blob.cs.

◆ data_at() [1/2]

T MyCaffe.common.Blob< T >.data_at ( int  n,
int  c,
int  h,
int  w 
)

Returns the data at a given location in the Blob.

Parameters
nSpecifies the num.
cSpecifies the channel.
hSpecifies the height.
wSpecifies the width.
Returns
The data item at the location is returned.

Definition at line 1119 of file Blob.cs.

◆ data_at() [2/2]

T MyCaffe.common.Blob< T >.data_at ( List< int >  rgIdx)

Returns the data at a given location in the Blob.

Parameters
rgIdxSpecifies an array of axes.
Returns
The data item at the location is returned.

Definition at line 1142 of file Blob.cs.

◆ diff_at() [1/2]

T MyCaffe.common.Blob< T >.diff_at ( int  n,
int  c,
int  h,
int  w 
)

Returns the diff at a given location in the Blob.

Parameters
nSpecifies the num.
cSpecifies the channel.
hSpecifies the height.
wSpecifies the width.
Returns
The diff item at the location is returned.

Definition at line 1132 of file Blob.cs.

◆ diff_at() [2/2]

T MyCaffe.common.Blob< T >.diff_at ( List< int >  rgIdx)

Returns the diff at a given location in the Blob.

Parameters
rgIdxSpecifies an array of axes.
Returns
The diff item at the location is returned.

Definition at line 1152 of file Blob.cs.

◆ Dispose() [1/2]

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

Releases all resources used by the Blob (including both GPU and Host).

Definition at line 367 of file Blob.cs.

◆ Dispose() [2/2]

virtual void MyCaffe.common.Blob< T >.Dispose ( bool  bDisposing)
protectedvirtual

Releases all resources used by the Blob (including both GPU and Host).

Parameters
bDisposingSet to true when disposing the object.

Definition at line 340 of file Blob.cs.

◆ FromProto()

void MyCaffe.common.Blob< T >.FromProto ( BlobProto  bp,
bool  bReshape = true 
)

Create a new Blob from a given BlobProto.

Parameters
bpSpecifies the BlobProto to use.
bReshapeSpecifies whether or not to reshape the Blob with the BlobProto shape.

Definition at line 1314 of file Blob.cs.

◆ GetConversionWorkSize()

ulong MyCaffe.common.Blob< T >.GetConversionWorkSize ( bool  bUseHalfSize)

Returns the amount of memory (in bytes) required to convert from base to half and back.

Parameters
bUseHalfSizeSpecifies whether or not we are converting to half size or not.

Definition at line 231 of file Blob.cs.

◆ GetData()

T MyCaffe.common.Blob< T >.GetData ( int  nIdx)

Returns the data at a given flat index within the Blob.

Parameters
nIdxSpecifies the flat index in the range [0,count()-1].
Returns
The data item at the index is returned.

Definition at line 1618 of file Blob.cs.

◆ GetDiff()

T MyCaffe.common.Blob< T >.GetDiff ( int  nIdx)

Returns the diff at a given flat index within the Blob.

Parameters
nIdxSpecifies the flat index in the range [0,count()-1].
Returns
The diff item at the index is returned.

Definition at line 1632 of file Blob.cs.

◆ GetMaxData()

double MyCaffe.common.Blob< T >.GetMaxData ( out long  lPos)

Returns the maximum data and the position where the maximum is located in the data.

Parameters
lPosReturns the location of the maximum.
Returns
Returns the maximum value.

Definition at line 2153 of file Blob.cs.

◆ GetMaxDiff()

double MyCaffe.common.Blob< T >.GetMaxDiff ( out long  lPos)

Returns the maximum diff and the position where the maximum is located in the diff.

Parameters
lPosReturns the location of the maximum.
Returns
Returns the maximum value.

Definition at line 2205 of file Blob.cs.

◆ GetMinData()

double MyCaffe.common.Blob< T >.GetMinData ( out long  lPos)

Returns the minimum data and the position where the minimum is located in the data.

Parameters
lPosReturns the location of the minimum.
Returns
Returns the minimum value.

Definition at line 2127 of file Blob.cs.

◆ GetMinDiff()

double MyCaffe.common.Blob< T >.GetMinDiff ( out long  lPos)

Returns the minimum diff and the position where the minimum is located in the diff.

Parameters
lPosReturns the location of the minimum.
Returns
Returns the minimum value.

Definition at line 2179 of file Blob.cs.

◆ LegacyShape()

int MyCaffe.common.Blob< T >.LegacyShape ( int  nIdx)

Returns the legacy shape at a given axis.

Parameters
nIdxSpecifies the axis.
Returns
The shape at a given axis is returned.

Definition at line 759 of file Blob.cs.

◆ Load()

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

Lods a new Blob from a binary reader.

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

Definition at line 2024 of file Blob.cs.

◆ MathAdd()

Blob< T > MyCaffe.common.Blob< T >.MathAdd ( Blob< T >  blobA,
fScale 
)

Clones the input Blob, scales the clone and then adds the data from this Blob to it.

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

Parameters
blobASpecifies the Blob to clone.
fScaleSpecifies the scaling factor to apply to the clone.
Returns
The Blob copy is returned.

Definition at line 1916 of file Blob.cs.

◆ MathDiv()

Blob< T > MyCaffe.common.Blob< T >.MathDiv ( fScale)

Clones the input Blob and divides a scalar from all of the clones data items.

Calculation: Y = Clone(this) * fScale

Parameters
fScaleSpecifies scaling factor.
Returns
The Blob copy is returned.

Definition at line 1953 of file Blob.cs.

◆ MathSub()

Blob< T > MyCaffe.common.Blob< T >.MathSub ( Blob< T >  blobA)

Clones the input Blob and subtracts the data from this blob from it.

Calculation: Y = Clone(blobA) + this

Parameters
blobASpecifies the Blob to clone.
Returns
The Blob copy is returned.

Definition at line 1936 of file Blob.cs.

◆ mean()

double MyCaffe.common.Blob< T >.mean ( float[]  rgDf = null,
bool  bDiff = false 
)

Calculate the mean of the blob data.

Parameters
rgDfOptionally, specifies the CPU data to use (default = null).
bDiffOptionally, specifies to use the diff instead of the data.
Returns
The mean is returned.

Definition at line 2580 of file Blob.cs.

◆ minmax_data()

Tuple< double, double, double, double > MyCaffe.common.Blob< T >.minmax_data ( Blob< T >  work,
bool  bDetectNans = false,
bool  bUseChunks = false 
)

Returns the minimum and maximum values in the data of the Blob.

Parameters
workSpecifies a workspace used to optimize the query.
bDetectNansOptionally, specifies whether or not to detect Nan's and Infinity values.
bUseChunksOptionally, specifies whether or not to use the min/max on all of the memory (default) or run in chunks (true).
Returns
A tuple containing the 'min', 'max' and optionally 'number of nans' and 'number of infinity' is returned for the data.

Definition at line 2239 of file Blob.cs.

◆ minmax_diff()

Tuple< double, double, double, double > MyCaffe.common.Blob< T >.minmax_diff ( Blob< T >  work,
bool  bDetectNans = false,
bool  bUseChunks = false 
)

Returns the minimum and maximum values in the diff of the Blob.

Parameters
workSpecifies a workspace used to optimize the query.
bDetectNansOptionally, specifies whether or not to detect Nan's and Infinity values.
bUseChunksOptionally, specifies whether or not to use the min/max on all of the memory (default) or run in chunks (true).
Returns
A tuple containing the 'min', 'max' and optionally 'number of nans' and 'number of infinity' is returned for the data.

Definition at line 2309 of file Blob.cs.

◆ NormalizeData()

void MyCaffe.common.Blob< T >.NormalizeData ( double?  dfMean = null,
double?  dfStd = null 
)

Normalize the blob data by subtracting the mean and dividing by the standard deviation.

Parameters
dfMeanOptionally, specifies a mean value to use (default = null).
dfStdOptionally, specifies a std value to use (default = null).

Definition at line 2557 of file Blob.cs.

◆ offset() [1/2]

int MyCaffe.common.Blob< T >.offset ( int  n,
int  c = 0,
int  h = 0,
int  w = 0 
)

Returns the flat offset given the number, channel, height and width.

Parameters
nSpecifies the num.
cSpecifies the channel.
hSpecifies the height.
wSpecifies the width.
Returns
The flat offset is returned.

Definition at line 784 of file Blob.cs.

◆ offset() [2/2]

int MyCaffe.common.Blob< T >.offset ( List< int >  rgIdx)

Returns the flat offset given the array of axes values.

Parameters
rgIdxSpecifies the array of axes values.
Returns
The flat offset is returned.

Definition at line 807 of file Blob.cs.

◆ Reshape() [1/4]

void MyCaffe.common.Blob< T >.Reshape ( BlobShape  shape,
bool?  bUseHalfSize = null 
)

Change the dimensions of the blob, allocating new memory if necessary.

This function can be called both to create an initial allocation of memory, and to adjust the dimensions of a top blob during Layer::Reshape or Layer::Forward. When changing the size of blob, memory will only be reallocated if sufficient memory does not already exist, and excess memory will not be freed until Dispose is called.

Note that reshaping an input blob and immediately calling Net::Backward is an error; either Net::Forward or Net::Reshape need to be called to propagate the new input shape to higher layers.

Parameters
shapeSpecifies the new shape of the Blob.
bUseHalfSizeOptionally, specifies to use half sized memory.

Definition at line 571 of file Blob.cs.

◆ Reshape() [2/4]

void MyCaffe.common.Blob< T >.Reshape ( int  nNum,
int  nChannels,
int  nHeight,
int  nWidth,
bool?  bUseHalfSize = null 
)

DEPRECIATED; use

Reshape(rgShape) instead.

Parameters
nNum
nChannels
nHeight
nWidth
bUseHalfSizeOptionally, specifies to use half sized memory.

Definition at line 380 of file Blob.cs.

◆ Reshape() [3/4]

void MyCaffe.common.Blob< T >.Reshape ( int[]  rgShape,
bool?  bUseHalfSize = null 
)

Change the dimensions of the blob, allocating new memory if necessary.

This function can be called both to create an initial allocation of memory, and to adjust the dimensions of a top blob during Layer::Reshape or Layer::Forward. When changing the size of blob, memory will only be reallocated if sufficient memory does not already exist, and excess memory will not be freed until Dispose is called.

Note that reshaping an input blob and immediately calling Net::Backward is an error; either Net::Forward or Net::Reshape need to be called to propagate the new input shape to higher layers.

Parameters
rgShapeSpecifies the new shape.
bUseHalfSizeOptionally, specifies to use half sized memory.

Definition at line 517 of file Blob.cs.

◆ Reshape() [4/4]

void MyCaffe.common.Blob< T >.Reshape ( List< int >  rgShape,
bool?  bUseHalfSize = null 
)

Change the dimensions of the blob, allocating new memory if necessary.

This function can be called both to create an initial allocation of memory, and to adjust the dimensions of a top blob during Layer::Reshape or Layer::Forward. When changing the size of blob, memory will only be reallocated if sufficient memory does not already exist, and excess memory will not be freed until Dispose is called.

Note that reshaping an input blob and immediately calling Net::Backward is an error; either Net::Forward or Net::Reshape need to be called to propagate the new input shape to higher layers.

Parameters
rgShapeSpecifies the new shape.
bUseHalfSizeOptionally, specifies to use half sized memory.

Definition at line 496 of file Blob.cs.

◆ ReshapeLike()

void MyCaffe.common.Blob< T >.ReshapeLike ( Blob< T >  b,
bool?  bUseHalfSize = null 
)

Reshape this Blob to have the same shape as another Blob.

Parameters
bSpecifies the other Blob.
bUseHalfSizeOptionally, specifies to use half sized memory.

Definition at line 582 of file Blob.cs.

◆ Resize()

Blob< T > MyCaffe.common.Blob< T >.Resize ( List< int >  rgShape)

The Resize method resizes the 3rd and 4th axes of the blob.

Currently, the Resize method only works on 4 axis blobs. Resize is different from Reshape in that Resize actually averages the data when resizing the blob.

Parameters
rgShapeSpecifies the new shape to resize to.
Returns
A newly re-sized Blob is returned.

Definition at line 2467 of file Blob.cs.

◆ Save()

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

Saves this Blob to a binary stream.

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

Definition at line 1970 of file Blob.cs.

◆ scale_data() [1/2]

void MyCaffe.common.Blob< T >.scale_data ( double  df)

Scale the data by a scaling factor.

Parameters
dfSpecifies the scaling factor.

Definition at line 1479 of file Blob.cs.

◆ scale_data() [2/2]

void MyCaffe.common.Blob< T >.scale_data ( fScaleFactor)

Scale the blob data by a constant factor.

Parameters
fScaleFactorSpecifies the scaling factor.

Definition at line 1507 of file Blob.cs.

◆ scale_diff() [1/2]

void MyCaffe.common.Blob< T >.scale_diff ( double  df)

Scale the diff by a scaling factor.

Parameters
dfSpecifies the scaling factor.

Definition at line 1488 of file Blob.cs.

◆ scale_diff() [2/2]

void MyCaffe.common.Blob< T >.scale_diff ( fScaleFactor)

Scale the blob diff by a constant factor.

Parameters
fScaleFactorSpecifies the scaling factor.

Definition at line 1516 of file Blob.cs.

◆ scale_to_range()

void MyCaffe.common.Blob< T >.scale_to_range ( double  dfMin,
double  dfMax 
)

Scale the data in the blob to the range [dfMin,dfMax].

Parameters
dfMinSpecifies the minimum of the range.
dfMaxSpecifies the maximum of the range.

Definition at line 1498 of file Blob.cs.

◆ SetCPUData()

void MyCaffe.common.Blob< T >.SetCPUData ( T[]  rg)

Sets just the CPU data to the data specified.

Parameters
rgSpecifies the CPU data to set.

Definition at line 1777 of file Blob.cs.

◆ SetData() [1/5]

void MyCaffe.common.Blob< T >.SetData ( double  dfVal,
int  nIdx = -1 
)

Either sets all of the data items in the Blob to a given value, or alternatively only sets a single indexed item to a given value.

Parameters
dfValSpecifies the value to set.
nIdxOptionally, specifies the index of the item to set.

Definition at line 1672 of file Blob.cs.

◆ SetData() [2/5]

void MyCaffe.common.Blob< T >.SetData ( double  dfVal,
int  nStartIdx,
int  nCount 
)

Set a data range with a given value.

Parameters
dfValSpecifies the value to set.
nStartIdxSpecifies the start index.
nCountSpecifies the number of items to set.

Definition at line 1686 of file Blob.cs.

◆ SetData() [3/5]

void MyCaffe.common.Blob< T >.SetData ( SimpleDatum  d,
bool  bReshape,
bool  bCopyData = true 
)

Sets the Blob values to the data contained within a SimpleDatum.

Parameters
dSpecifies the SimpleDatum.
bReshapeSpecifies whether or not to reshape the Blob to match the SimpleDatum.
bCopyDataOptionally, specifies whether or not to transfer the data.

Definition at line 1754 of file Blob.cs.

◆ SetData() [4/5]

void MyCaffe.common.Blob< T >.SetData ( fVal,
int  nIdx = -1 
)

Either sets all of the data items in the Blob to a given value, or alternatively only sets a single indexed item to a given value.

Parameters
fValSpecifies the value to set.
nIdxOptionally, specifies the index of the item to set.

Definition at line 1658 of file Blob.cs.

◆ SetData() [5/5]

void MyCaffe.common.Blob< T >.SetData ( T[]  rgData,
int  nCount = -1,
bool  bSetCount = true 
)

Sets a number of items within the Blob's data.

Parameters
rgDataSpecifies the data to set.
nCountOptionally, specifies a subset count of items to set.
bSetCountOptionally, specifies whether or not to set the count. The count is always set when re-allocating the buffer.

Definition at line 1647 of file Blob.cs.

◆ SetDiff() [1/3]

void MyCaffe.common.Blob< T >.SetDiff ( double  dfVal,
int  nIdx = -1 
)

Either sets all of the diff items in the Blob to a given value, or alternatively only sets a single indexed item to a given value.

Parameters
dfValSpecifies the value to set.
nIdxOptionally, specifies the index of the item to set.

Definition at line 1706 of file Blob.cs.

◆ SetDiff() [2/3]

void MyCaffe.common.Blob< T >.SetDiff ( double  dfVal,
int  nStartIdx,
int  nCount 
)

Set a diff range with a given value.

Parameters
dfValSpecifies the value to set.
nStartIdxSpecifies the start index.
nCountSpecifies the number of items to set.

Definition at line 1723 of file Blob.cs.

◆ SetDiff() [3/3]

void MyCaffe.common.Blob< T >.SetDiff ( T[]  rgDiff,
int  nCount = -1,
bool  bSetCount = true 
)

Sets a number of items within the Blob's diff.

Parameters
rgDiffSpecifies the diff to set.
nCountOptionally, specifies a subset count of items to set.
bSetCountOptionally, specifies whether or not to set the count. The count is always set when re-allocating the buffer.

Definition at line 1743 of file Blob.cs.

◆ SetPixel() [1/2]

Tuple< T, T, T > MyCaffe.common.Blob< T >.SetPixel ( int  nX,
int  nY,
byte  R,
byte  G,
byte  B,
TransformationParameter.COLOR_ORDER  order = TransformationParameter.COLOR_ORDER.RGB 
)

Set the values of a 3 channel image embedded within the blob in the order RGB or BGR where the full hxw is stored for each color in order.

Parameters
nXSpecifies the x pixel within the image.
nYSpecifies the y pxiel within the image.
RSpecifies the color for the Red color channel.
GSpecifies the color for the Green color channel.
BSpecifies the color for the Blue color channel.
orderOptionally, specifies the color ordering RGB or BGR (default = RGB).
Returns
The original pixel is returned as a three item tuple.

Definition at line 2629 of file Blob.cs.

◆ SetPixel() [2/2]

Tuple< T, T, T > MyCaffe.common.Blob< T >.SetPixel ( int  nX,
int  nY,
Tuple< T, T, T >  pixel,
bool  bReturnOriginal = false,
TransformationParameter.COLOR_ORDER  order = TransformationParameter.COLOR_ORDER.RGB,
int  nOffset = 0 
)

Sets a pixel to the values within a three item tuple where the first item is assigned RED, second GREEN and third BLUE.

Parameters
nXSpecifies the x pixel within the image.
nYSpecifies the y pxiel within the image.
pixelSpecifies the color values for RED, GREEN and BLUE.
bReturnOriginalOptionally, specifies to return the original pixel.
orderOptionally, specifies the color ordering RGB or BGR (default = RGB).
nOffsetOptionally, specifies the offset to start at (default = 0).
Returns
The original pixel is returned as a three item tuple.

Definition at line 2662 of file Blob.cs.

◆ shape() [1/2]

List< int > MyCaffe.common.Blob< T >.shape ( )

Returns an array where each element contains the shape of an axis of the Blob.

Returns
The shape array is returned.

Definition at line 618 of file Blob.cs.

◆ shape() [2/2]

int MyCaffe.common.Blob< T >.shape ( int  nIdx)

Returns the dimension of the nIdx'th axis (or the negative nIdx'th axis from teh end, if nIdx is negative.

Parameters
nIdxThe axis index, which may be negative as it will be 'canonicalized' using CanonicalAxisIndex.
Returns

Definition at line 630 of file Blob.cs.

◆ ShapeEquals()

bool MyCaffe.common.Blob< T >.ShapeEquals ( BlobProto  bp)

Compares the shape of this blob to the shape within a BlobProto.

Parameters
bpSpecifies the BlobProto to compare.
Returns
If the shapes are the same this method returns true, otherwise false.

Definition at line 1804 of file Blob.cs.

◆ Share()

void MyCaffe.common.Blob< T >.Share ( Blob< T >  b)

Share another Blob with this one, by setting the data and diff to the same data and diff of the other Blob.

Parameters
bSpecifies the other Blob to share.

Definition at line 1575 of file Blob.cs.

◆ ShareData()

void MyCaffe.common.Blob< T >.ShareData ( Blob< T >  b)

Set the data to point to the data of the other blob – useful in Layers which simply perform a copy in their forward pass.

Parameters
b

Definition at line 1538 of file Blob.cs.

◆ ShareDiff()

void MyCaffe.common.Blob< T >.ShareDiff ( Blob< T >  b)

Set the diff to point to the diff of the other blob – useful in Layers which simply perform a copy in their forward pass.

Parameters
b

Definition at line 1557 of file Blob.cs.

◆ std()

double MyCaffe.common.Blob< T >.std ( double?  dfMean = null,
float[]  rgDf = null 
)

Calculate the standard deviation of the blob data.

Parameters
dfMeanOptionally, specifies the mean to use (default = null).
rgDfOptionally, specifies the CPU data to calculate the std on (default = null).
Returns
The standard deviation of the bob data is returned.

Definition at line 2601 of file Blob.cs.

◆ sumsq_data()

T MyCaffe.common.Blob< T >.sumsq_data ( )

Calcualte the sum of squares (L2 norm squared) of the data.

Returns

Definition at line 1455 of file Blob.cs.

◆ sumsq_diff()

T MyCaffe.common.Blob< T >.sumsq_diff ( )

Calcualte the sum of squares (L2 norm squared) of the diff.

Returns

Definition at line 1467 of file Blob.cs.

◆ ToDatum()

Datum MyCaffe.common.Blob< T >.ToDatum ( )

Returns a new Datum that contains the shape and data of the Blob.

Returns
A Datum is returned.

Definition at line 1855 of file Blob.cs.

◆ ToProto()

BlobProto MyCaffe.common.Blob< T >.ToProto ( bool  bWriteDiff = false)

Writes the Blob to a new BlobProto.

Parameters
bWriteDiffWhen true, the diff is written to the BlobProto, otherwise the data is written.
Returns
The new BlobProto is returned.

Definition at line 1388 of file Blob.cs.

◆ ToSizeString()

string MyCaffe.common.Blob< T >.ToSizeString ( )

Returns a string describing the 4D shape of the Blob.

Returns
A shape string is returned.

Definition at line 1846 of file Blob.cs.

◆ ToString() [1/2]

override string MyCaffe.common.Blob< T >.ToString ( )

Returns a string representation of the Blob.

Returns

Definition at line 2081 of file Blob.cs.

◆ ToString() [2/2]

string MyCaffe.common.Blob< T >.ToString ( int  nMax,
bool  bDiff = false 
)

Get the string representation containing up to the first 'nMax' items.

Parameters
nMaxSpecifies the maximum number of data items to return.
bDiffSpecifies to returive the diff when true.
Returns
The string representation is returned.

Definition at line 2093 of file Blob.cs.

◆ Update()

void MyCaffe.common.Blob< T >.Update ( )

The 'update' method is used for parameter blobs in a Net.

Update is called to apply the diff errors to the data. When !bIncludeDiff or freeze_learning = true, no diff is applied.

Definition at line 1300 of file Blob.cs.

◆ update_cpu_data()

T[] MyCaffe.common.Blob< T >.update_cpu_data ( )

Update the CPU data by transferring the GPU data over to the Host.

Returns
The Host data is returned.

Definition at line 1195 of file Blob.cs.

◆ update_cpu_diff()

T[] MyCaffe.common.Blob< T >.update_cpu_diff ( )

Update the CPU diff by transferring the GPU diff over to the Host.

Returns
The Host diff is returned.

Definition at line 1254 of file Blob.cs.

Member Data Documentation

◆ MAX_BLOB_AXES

const int MyCaffe.common.Blob< T >.MAX_BLOB_AXES = 32
static

Defines the maximum number of Axes supported by the Blob.

Definition at line 52 of file Blob.cs.

Property Documentation

◆ channels

int MyCaffe.common.Blob< T >.channels
get

DEPRECIATED; legacy shape accessor channels: use shape(1) instead.

Definition at line 733 of file Blob.cs.

◆ cpu_data

T [] MyCaffe.common.Blob< T >.cpu_data
get

Returns the last host data retrieved from the GPU.

Definition at line 1176 of file Blob.cs.

◆ cpu_diff

T [] MyCaffe.common.Blob< T >.cpu_diff
get

Returns the last host diff retrieved from the GPU.

Definition at line 1220 of file Blob.cs.

◆ Cuda

CudaDnn<T> MyCaffe.common.Blob< T >.Cuda
get

Returns the CudaDnn object that manages the Blob's memory."/>

Definition at line 323 of file Blob.cs.

◆ data

Returns the SyncedMemory that stores the data.

Definition at line 1160 of file Blob.cs.

◆ diff

Returns the SyncedMemory that stores the diff.

Definition at line 1168 of file Blob.cs.

◆ DiffExists

bool MyCaffe.common.Blob< T >.DiffExists
get

Returns whether or not the Diff portion exists.

Definition at line 609 of file Blob.cs.

◆ freeze_learning

bool MyCaffe.common.Blob< T >.freeze_learning
getset

Specifies whether or not the diff is applied to the data during Update. When freeze learning = true, the update is skipped.

Definition at line 314 of file Blob.cs.

◆ gpu_data

long MyCaffe.common.Blob< T >.gpu_data
get

Returns the data GPU handle used by the CudaDnn connection.

Definition at line 1203 of file Blob.cs.

◆ gpu_diff

long MyCaffe.common.Blob< T >.gpu_diff
get

Returns the diff GPU handle used by the CudaDnn connection.

Definition at line 1265 of file Blob.cs.

◆ gpu_shape

long MyCaffe.common.Blob< T >.gpu_shape
get

Returns the shape GPU handle used by the CudaDnn connection. The shape data contains the shape information of the Blob for use in GPU operations.

Definition at line 1289 of file Blob.cs.

◆ HalfSize

bool MyCaffe.common.Blob< T >.HalfSize
get

Returns whether or not this blob is using half sizes.

Definition at line 306 of file Blob.cs.

◆ height

int MyCaffe.common.Blob< T >.height
get

DEPRECIATED; legacy shape accessor height: use shape(2) instead.

Definition at line 741 of file Blob.cs.

◆ Log

Returns the Log associated with the blob.

Definition at line 331 of file Blob.cs.

◆ max_data

double MyCaffe.common.Blob< T >.max_data
get

Returns the maximum value in the data of the Blob.

Definition at line 2139 of file Blob.cs.

◆ max_diff

double MyCaffe.common.Blob< T >.max_diff
get

Returns the maximum value in the diff of the Blob.

Definition at line 2191 of file Blob.cs.

◆ min_data

double MyCaffe.common.Blob< T >.min_data
get

Returns the minimum value in the data of the Blob.

Definition at line 2113 of file Blob.cs.

◆ min_diff

double MyCaffe.common.Blob< T >.min_diff
get

Returns the minimum value in the diff of the Blob.

Definition at line 2165 of file Blob.cs.

◆ MinusOne

T MyCaffe.common.Blob< T >.MinusOne
staticget

Returns MinusOne (-1) in type T.

Definition at line 213 of file Blob.cs.

◆ mutable_cpu_data

T [] MyCaffe.common.Blob< T >.mutable_cpu_data
getset

Get data from the GPU and bring it over to the host, or Set data from the Host and send it over to the GPU.

Definition at line 1185 of file Blob.cs.

◆ mutable_cpu_diff

T [] MyCaffe.common.Blob< T >.mutable_cpu_diff
getset

Get diff from the GPU and bring it over to the host, or Set diff from the Host and send it over to the GPU.

Definition at line 1235 of file Blob.cs.

◆ mutable_gpu_data

long MyCaffe.common.Blob< T >.mutable_gpu_data
get

Returns the data GPU handle used by the CudaDnn connection.

Definition at line 1211 of file Blob.cs.

◆ mutable_gpu_diff

long MyCaffe.common.Blob< T >.mutable_gpu_diff
get

Returns the diff GPU handle used by the CudaDnn connection.

Definition at line 1279 of file Blob.cs.

◆ Name

string MyCaffe.common.Blob< T >.Name
getset

Get/set the name of the Blob.

Definition at line 1872 of file Blob.cs.

◆ num

int MyCaffe.common.Blob< T >.num
get

DEPRECIATED; legacy shape accessor num: use shape(0) instead.

Definition at line 725 of file Blob.cs.

◆ num_axes

int MyCaffe.common.Blob< T >.num_axes
get

Returns the number of axes in the Blob.

Definition at line 638 of file Blob.cs.

◆ num_true_axes

int MyCaffe.common.Blob< T >.num_true_axes
get

Returns the number of true axes, ignoring the trailing ones.

Definition at line 649 of file Blob.cs.

◆ One

T MyCaffe.common.Blob< T >.One
staticget

Returns One (1) in type T.

Definition at line 205 of file Blob.cs.

◆ Padded

bool MyCaffe.common.Blob< T >.Padded
getset

Get/set the padding state of the blob.

Definition at line 221 of file Blob.cs.

◆ reshape_when_sharing

bool MyCaffe.common.Blob< T >.reshape_when_sharing
getset

When true, this Blob is reshaped to the source when sharing the source data (default = false).

This setting is used by the Net when sharing trained weights.

Definition at line 1527 of file Blob.cs.

◆ shape_string

string MyCaffe.common.Blob< T >.shape_string
get

Returns a string describing the Blob's shape.

Definition at line 590 of file Blob.cs.

◆ snapshot_requested

bool MyCaffe.common.Blob< T >.snapshot_requested
getset

Get/set the snapshot request.

This setting is used by learnable parameters that have requested a snapshot.

Definition at line 1607 of file Blob.cs.

◆ Tag

object MyCaffe.common.Blob< T >.Tag
getset

Returns a user defined object associated with the Blob.

Definition at line 2384 of file Blob.cs.

◆ type

BLOB_TYPE MyCaffe.common.Blob< T >.type
getset

Returns the BLOB_TYPE of the Blob.

Definition at line 2375 of file Blob.cs.

◆ width

int MyCaffe.common.Blob< T >.width
get

DEPRECIATED; legacy shape accessor width: use shape(3) instead.

Definition at line 749 of file Blob.cs.

◆ Zero

T MyCaffe.common.Blob< T >.Zero
staticget

Returns Zero (0) in type T.

Definition at line 197 of file Blob.cs.


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