MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
The Blob is the main holder of data that moves through the Layers of the Net. More...
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... | |
void | Unsqueeze (int nNumAxes) |
Unsqueeze the shape by adding shape=1 on each axis until the 'nNumAxes' is reached. More... | |
double? | GetParameter (string strName) |
Get a blob parameter. More... | |
void | SetParameter (string strName, double dfVal) |
Set a blob parameter. More... | |
void | CopyParameters (Blob< T > b) |
Copy the parameters from another blob. 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 | CopyFromAndPad (Blob< T > src, double dfPad=0, bool bCopyDiff=false) |
Copy the source data to this Blob, and if this blob is larger than the source, pad this blob with 'dfPad' values to the right. More... | |
void | CopyFromAndTransposeHeightWidth (Blob< T > blobSrc, bool bCopyDiff=false, bool bUseCuda=true) |
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... | |
bool | Compare (Blob< T > other, Blob< T > work, bool bDiff=false, double dfTol=1e-8, bool bZeroCheck=true, bool bFullCompare=false, bool bDetectNans=true, bool bForceOtherData=false) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not. More... | |
bool | CompareEx (Blob< T > other, Blob< T > work, out double dfMin, out double dfMax, bool bDiff=false, double dfTol=1e-8, bool bZeroCheck=true, bool bFullCompare=false, bool bDetectNans=true, bool bForceOtherData=false) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not. More... | |
bool | ValidateData (Blob< T > work, bool bDiff=false) |
Validate the data or diff looking for NAN or Inf. More... | |
bool | Compare (CudaDnn< double > cuda, Blob< T > other, Blob< double > work, bool bDiff=false, double dfTol=1e-8) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not. More... | |
T | data_at (int n, int c, int h, int w) |
Returns the data at a given location in the Blob. More... | |
T | diff_at (int n, int c, int h, int w) |
Returns the diff at a given location in the Blob. More... | |
T | data_at (List< int > rgIdx) |
Returns the data at a given location in the Blob. More... | |
T | 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... | |
T | asum_data () |
Compute the sum of absolute values (L1 norm) of the data. More... | |
T | asum_diff () |
Compute the sum of absolute values (L1 norm) of the diff. More... | |
T | sumsq_data () |
Calcualte the sum of squares (L2 norm squared) of the data. More... | |
T | 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... | |
T | GetData (int nIdx) |
Returns the data at a given flat index within the Blob. More... | |
T | 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, bool bCompareCpuDataLen=false) |
Compares the shape of this blob to another shape. More... | |
bool | CompareShape (int[] rgShape, bool bCompareCpuDataLen=false) |
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 | SaveBinary (string strFile, bool bData, bool bDiff, bool bIncludeName=true) |
Saves the blob to a binary file. More... | |
void | Save (BinaryWriter bw, bool bData, bool bDiff, bool bIncludeName=true) |
Saves this Blob to a binary stream. More... | |
byte[] | ToByteArray () |
Saves this Blob to a byte array. 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 | sum (float[] rgDf=null, bool bDiff=false) |
Calculate the sum 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... | |
void | SaveToImage (string strFile, bool bNonZeroExistOnly=true, bool bSaveDiff=false, Dictionary< float, Color > rgSpecialValues=null) |
Save the Blob to an image where values less than 0 are colored red, and values greater than 0 are colored green. Values = 0 are colored black. More... | |
void | SaveToNumpy (string strFile, bool bSaveDiff=false) |
Save a blob with data to a Numpy .npy file. More... | |
Tuple< float[], int[]> | LoadFromNumpy (string strFile, bool bLoadDiff=false, bool bLoadDataOnly=false, Log log=null, int nMax=int.MaxValue) |
Load a blob with data from a Numpy array .npy file. More... | |
void | MatMul (Blob< T > blobA, Blob< T > blobB, bool bReshape=false, bool bTransA=false, bool bTransB=false, double dfScale=1.0, bool bADiff=false, bool bBDiff=false, bool bCDiff=false) |
MatMul blobA with blobB and place the result in this blob (e.g. this = matmul(A, B)). All blobs are in row-major format. More... | |
void | MatMulGrad (Blob< T > blobA, Blob< T > blobB, Blob< T > blobWork, double dfScale=1.0) |
Calculates and propagates the gradient for blobA and BlobB given the input gradient in this blob's diff values. After this call, the blobA and blobB diff values are filled with their respective gradients. More... | |
void | Percentile (Blob< T > blobY, double dfPercentile) |
Calculates the percentile and places the result in blobY. More... | |
Static Public Member Functions | |
static Blob< T > | LoadBinary (CudaDnn< T > cuda, Log log, string strFile, bool bData, bool bDiff) |
Loads a blob from a binary file (previously saved with SaveBinary). More... | |
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 Blob< T > | FromByteArray (CudaDnn< T > cuda, Log log, byte[] rg) |
A new Blob is created from the byte array, previously saved with ToByteArray. More... | |
static void | SaveToNumpy (string strFile, float[] rgData, int[] rgShape) |
Save a blob with data to a Numpy .npy file. More... | |
static void | SaveToNumpy (string strFile, int[] rgData, int[] rgShape) |
Save a blob with data to a Numpy .npy file. More... | |
static void | SaveToNumpy (string strFile, long[] rgData, int[] rgShape) |
Save a blob with data to a Numpy .npy file. More... | |
static Tuple< List< float[]>, int[], List< string > > | LoadFromNumpy (string strFile, Log log=null, int nMax=int.MaxValue, int nStartIdx=0, int nCount=int.MaxValue) |
Load the long, int, bool, float, or double data from a very large Numpy array .npy file, reading in col order. 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... | |
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 through the Net Layers on the backward pass.
T | Specifies the base type float or double. Using float is recommended to conserve GPU memory. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
bool | bIncludeDiff = true , |
||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
bIncludeDiff | Optionally, specifies whether or not to include (and allocate) the Diff data. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
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.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
nNum | Specifies the number of inputs. |
nChannels | Specifies the number of channels per input. |
nHeight | Specifies the height of each input. |
nWidth | Specifies the width of each input. |
bIncludeDiff | Optionally, specifies whether or not to include (and allocate) the Diff data. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
List< int > | rgShape, | ||
bool | bIncludeDiff = true , |
||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
rgShape | Specifies the shape of each axis of the Blob. |
bIncludeDiff | Optionally, specifies whether or not to include (and allocate) the Diff data. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
int[] | rgShape, | ||
bool | bIncludeDiff = true , |
||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
rgShape | Specifies the shape of each axis of the Blob. |
bIncludeDiff | Optionally, specifies whether or not to include (and allocate) the Diff data. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
Blob< T > | b, | ||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
b | Create this blob to be like another Blob (e.g. same shape). |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
SimpleDatum | d, | ||
bool | bCopyData = false , |
||
bool | bIncludeDiff = true , |
||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
d | Specifies the datum for which the Blob is shaped to match. |
bCopyData | Optionally, specifies whether or not to actually copy the data. When false, the shape is set, but no data is copied. |
bIncludeDiff | Optionally, specifies whether or not to include (and allocate) the Diff data. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
MyCaffe.common.Blob< T >.Blob | ( | CudaDnn< T > | cuda, |
Log | log, | ||
BlobProto | bp, | ||
bool | bUseHalfSize = false |
||
) |
The Blob constructor.
cuda | Specifies the CudaDnn instance used to communidate with Cuda. |
log | Specifies the Log for output. |
bp | Specifies the BlobProto used to load the Blob. |
bUseHalfSize | Optionally, specifies to use half size (FP16) for both data and diff. This option is only available when using the float base type 'T'. |
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.
blob | Specifies the blob whos data is to be shared. |
lCount | Specifies the number of items to share. |
lOffset | Specifies the offset into the blob where the shareing starts. |
void MyCaffe.common.Blob< T >.add_scalar | ( | double | dfVal | ) |
T MyCaffe.common.Blob< T >.asum_data | ( | ) |
T MyCaffe.common.Blob< T >.asum_diff | ( | ) |
void MyCaffe.common.Blob< T >.AsyncGpuPush | ( | long | hStream | ) |
int MyCaffe.common.Blob< T >.CanonicalAxisIndex | ( | int | nIdx | ) |
Blob< T > MyCaffe.common.Blob< T >.Clone | ( | ) |
bool MyCaffe.common.Blob< T >.Compare | ( | Blob< T > | other, |
Blob< T > | work, | ||
bool | bDiff = false , |
||
double | dfTol = 1e-8 , |
||
bool | bZeroCheck = true , |
||
bool | bFullCompare = false , |
||
bool | bDetectNans = true , |
||
bool | bForceOtherData = false |
||
) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not.
other | Specifies the other blob to compare. |
work | Specifies a temporary work blob. |
bDiff | Specifies to compare the diff. |
dfTol | Specifies the accepted tolerance. |
bZeroCheck | Optionally, specifies to check for all zeros (default = false). |
bFullCompare | Optionally, compare each item individually (default = false). |
bDetectNans | Optionally, detect NAN's (default = true). |
bForceOtherData | Optionally, force using the other blobs data even when bDiff = true. |
bool MyCaffe.common.Blob< T >.Compare | ( | CudaDnn< double > | cuda, |
Blob< T > | other, | ||
Blob< double > | work, | ||
bool | bDiff = false , |
||
double | dfTol = 1e-8 |
||
) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not.
cuda | Specifies a double precision CudaDnn. |
other | Specifies the other blob to compare. |
work | Specifies a temporary work blob. |
bDiff | Specifies to compare the diff. |
dfTol | Specifies the accepted tolerance. |
bool MyCaffe.common.Blob< T >.CompareEx | ( | Blob< T > | other, |
Blob< T > | work, | ||
out double | dfMin, | ||
out double | dfMax, | ||
bool | bDiff = false , |
||
double | dfTol = 1e-8 , |
||
bool | bZeroCheck = true , |
||
bool | bFullCompare = false , |
||
bool | bDetectNans = true , |
||
bool | bForceOtherData = false |
||
) |
Compare the data (or diff) of one blob to another and return true if all items fall within the specified tolerance or not.
other | Specifies the other blob to compare. |
work | Specifies a temporary work blob. |
dfMin | Returns the min difference. |
dfMax | Returns the max difference. |
bDiff | Specifies to compare the diff. |
dfTol | Specifies the accepted tolerance. |
bZeroCheck | Optionally, specifies to check for all zeros (default = false). |
bFullCompare | Optionally, compare each item individually (default = false). |
bDetectNans | Optionally, detect NAN's (default = true). |
bForceOtherData | Optionally, force using the other blobs data even when bDiff = true. |
bool MyCaffe.common.Blob< T >.CompareShape | ( | int[] | rgShape, |
bool | bCompareCpuDataLen = false |
||
) |
bool MyCaffe.common.Blob< T >.CompareShape | ( | List< int > | rgShape, |
bool | bCompareCpuDataLen = false |
||
) |
void MyCaffe.common.Blob< T >.ConvertToBase | ( | long | hWorkMem, |
ulong | lWorkSize, | ||
bool | bData, | ||
bool | bDiff | ||
) |
void MyCaffe.common.Blob< T >.ConvertToHalf | ( | long | hWorkMem, |
ulong | lWorkSize, | ||
bool | bData, | ||
bool | bDiff | ||
) |
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.
blobSrc | Specifies the source blob to copy from. |
nChannelFrom | Specifies the channel within the source to copy from. |
nChannelTo | Specifies the channel in the destination (this blob) to copy into. |
bCopyDiff | Specifies whether or not to copy the data or diff. |
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.
src | The Blob to copy from. |
bCopyDiff | If false, copy the data; if true, copy the diff. |
bReshape | If 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. |
hDstHostBuffer | Optionally, specifies the host buffer of the destination. |
bIgnoreShape | Optionally, specifies to ignore the shape and just make sure the count is the same before copying (default = false). |
void MyCaffe.common.Blob< T >.CopyFrom | ( | Blob< T > | src, |
int | nSrcOffset, | ||
int | nDstOffset, | ||
int | nCount, | ||
bool | bCopyData, | ||
bool | bCopyDiff | ||
) |
void MyCaffe.common.Blob< T >.CopyFromAndPad | ( | Blob< T > | src, |
double | dfPad = 0 , |
||
bool | bCopyDiff = false |
||
) |
void MyCaffe.common.Blob< T >.CopyFromAndTransposeHeightWidth | ( | Blob< T > | blobSrc, |
bool | bCopyDiff = false , |
||
bool | bUseCuda = true |
||
) |
Copy from a source Blob and transpose the height and width of the copy.
blobSrc | Specifies the Blob to copy from. |
bCopyDiff | Optionally, specifies to copy and transform the diff instead of the data (default = false). |
bUseCuda | Optionally, specifies to use CUDA function for transformations (default = true) |
void MyCaffe.common.Blob< T >.CopyParameters | ( | Blob< T > | b | ) |
int MyCaffe.common.Blob< T >.count | ( | ) |
int MyCaffe.common.Blob< T >.count | ( | int | nStartIdx | ) |
int MyCaffe.common.Blob< T >.count | ( | int | nStartIdx, |
int | nEndIdx | ||
) |
T MyCaffe.common.Blob< T >.data_at | ( | int | n, |
int | c, | ||
int | h, | ||
int | w | ||
) |
T MyCaffe.common.Blob< T >.data_at | ( | List< int > | rgIdx | ) |
T MyCaffe.common.Blob< T >.diff_at | ( | int | n, |
int | c, | ||
int | h, | ||
int | w | ||
) |
T MyCaffe.common.Blob< T >.diff_at | ( | List< int > | rgIdx | ) |
void MyCaffe.common.Blob< T >.Dispose | ( | ) |
|
protectedvirtual |
|
static |
void MyCaffe.common.Blob< T >.FromProto | ( | BlobProto | bp, |
bool | bReshape = true |
||
) |
ulong MyCaffe.common.Blob< T >.GetConversionWorkSize | ( | bool | bUseHalfSize | ) |
T MyCaffe.common.Blob< T >.GetData | ( | int | nIdx | ) |
T MyCaffe.common.Blob< T >.GetDiff | ( | int | nIdx | ) |
double MyCaffe.common.Blob< T >.GetMaxData | ( | out long | lPos | ) |
double MyCaffe.common.Blob< T >.GetMaxDiff | ( | out long | lPos | ) |
double MyCaffe.common.Blob< T >.GetMinData | ( | out long | lPos | ) |
double MyCaffe.common.Blob< T >.GetMinDiff | ( | out long | lPos | ) |
double? MyCaffe.common.Blob< T >.GetParameter | ( | string | strName | ) |
int MyCaffe.common.Blob< T >.LegacyShape | ( | int | nIdx | ) |
|
static |
|
static |
Loads a blob from a binary file (previously saved with SaveBinary).
cuda | Specifies the instance of the CudaDnn connection to use. |
log | Specifies the Log for output. |
strFile | Specifies the file to load the data/diff from. |
bData | Specifies to load the data. |
bDiff | Specifies to load the diff. |
Tuple< float[], int[]> MyCaffe.common.Blob< T >.LoadFromNumpy | ( | string | strFile, |
bool | bLoadDiff = false , |
||
bool | bLoadDataOnly = false , |
||
Log | log = null , |
||
int | nMax = int.MaxValue |
||
) |
Load a blob with data from a Numpy array .npy file.
strFile | Specifies the .npy file name. |
bLoadDiff | Specifies to load the diff, when false, the data is loaded. |
bLoadDataOnly | Specifies to load the data and return it as an array but do not load the gpu memory. |
log | Optionally, specifies the output log. |
nMax | Optionally, specifies the maximum number of items to load. |
Exception | An exception is thrown when an invalid or unsupported feature is located. |
|
static |
Load the long, int, bool, float, or double data from a very large Numpy array .npy file, reading in col order.
strFile | Specifies the .npy file name. |
log | Optionally, specifies the output log. |
nMax | Optionally, specifies the maximum number of items to load (default = MaxValue). |
nStartIdx | Optionally, specifies a start index of items to read (default = 0). |
nCount | Optionally, specifies the number of items to load from the start index (default = MaxValue). |
Exception | An exception is thrown when an invalid or unsupported feature is located. |
Blob< T > MyCaffe.common.Blob< T >.MathAdd | ( | Blob< T > | blobA, |
T | fScale | ||
) |
Blob< T > MyCaffe.common.Blob< T >.MathDiv | ( | T | fScale | ) |
Blob< T > MyCaffe.common.Blob< T >.MathSub | ( | Blob< T > | blobA | ) |
void MyCaffe.common.Blob< T >.MatMul | ( | Blob< T > | blobA, |
Blob< T > | blobB, | ||
bool | bReshape = false , |
||
bool | bTransA = false , |
||
bool | bTransB = false , |
||
double | dfScale = 1.0 , |
||
bool | bADiff = false , |
||
bool | bBDiff = false , |
||
bool | bCDiff = false |
||
) |
MatMul blobA with blobB and place the result in this blob (e.g. this = matmul(A, B)). All blobs are in row-major format.
blobA | Specifies the first input with last 2 axes size of MxK row-major matrix (first axes must match blobB's) |
blobB | Specifies the second input with last 2 axes size of KxN row-major matrix (first axes must match blobA's) |
dfScale | Specifies the scale applied to blobB. |
bReshape | Specifies to reshape this blob the the expected shape (default = false). |
bTransA | Specifies to transpose A first. |
bTransB | Specifies to transpose B first. |
bADiff | Specifies to use the diff values in blobA, otherwise the data values are used (default = false). |
bBDiff | Specifies to use the diff values in blobB, otherwise the data values are used (default = false). |
bCDiff | Specifies to use the diff values in blobC, otherwise the data values are used (default = false). |
void MyCaffe.common.Blob< T >.MatMulGrad | ( | Blob< T > | blobA, |
Blob< T > | blobB, | ||
Blob< T > | blobWork, | ||
double | dfScale = 1.0 |
||
) |
Calculates and propagates the gradient for blobA and BlobB given the input gradient in this blob's diff values. After this call, the blobA and blobB diff values are filled with their respective gradients.
blobA | Specifies the blobA where blobA gradients are placed (in diff values). |
blobB | Specifies the blobB where blobB gradients are placed (in diff values). |
blobWork | Specifies a work blob. |
dfScale | Specifies a scale to be applied to the diffs in this blob before the MatMul (default = 1.0). |
double MyCaffe.common.Blob< T >.mean | ( | float[] | rgDf = null , |
bool | bDiff = false |
||
) |
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.
work | Specifies a workspace used to optimize the query. |
bDetectNans | Optionally, specifies whether or not to detect Nan's and Infinity values. |
bUseChunks | Optionally, specifies whether or not to use the min/max on all of the memory (default) or run in chunks (true). |
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.
work | Specifies a workspace used to optimize the query. |
bDetectNans | Optionally, specifies whether or not to detect Nan's and Infinity values. |
bUseChunks | Optionally, specifies whether or not to use the min/max on all of the memory (default) or run in chunks (true). |
void MyCaffe.common.Blob< T >.NormalizeData | ( | double? | dfMean = null , |
double? | dfStd = null |
||
) |
int MyCaffe.common.Blob< T >.offset | ( | int | n, |
int | c = 0 , |
||
int | h = 0 , |
||
int | w = 0 |
||
) |
int MyCaffe.common.Blob< T >.offset | ( | List< int > | rgIdx | ) |
void MyCaffe.common.Blob< T >.Percentile | ( | Blob< T > | blobY, |
double | dfPercentile | ||
) |
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.
shape | Specifies the new shape of the Blob. |
bUseHalfSize | Optionally, specifies to use half sized memory. |
void MyCaffe.common.Blob< T >.Reshape | ( | int | nNum, |
int | nChannels, | ||
int | nHeight, | ||
int | nWidth, | ||
bool? | bUseHalfSize = null |
||
) |
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.
rgShape | Specifies the new shape. |
bUseHalfSize | Optionally, specifies to use half sized memory. |
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.
rgShape | Specifies the new shape. |
bUseHalfSize | Optionally, specifies to use half sized memory. |
void MyCaffe.common.Blob< T >.ReshapeLike | ( | Blob< T > | b, |
bool? | bUseHalfSize = null |
||
) |
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.
rgShape | Specifies the new shape to resize to. |
void MyCaffe.common.Blob< T >.Save | ( | BinaryWriter | bw, |
bool | bData, | ||
bool | bDiff, | ||
bool | bIncludeName = true |
||
) |
void MyCaffe.common.Blob< T >.SaveBinary | ( | string | strFile, |
bool | bData, | ||
bool | bDiff, | ||
bool | bIncludeName = true |
||
) |
void MyCaffe.common.Blob< T >.SaveToImage | ( | string | strFile, |
bool | bNonZeroExistOnly = true , |
||
bool | bSaveDiff = false , |
||
Dictionary< float, Color > | rgSpecialValues = null |
||
) |
Save the Blob to an image where values less than 0 are colored red, and values greater than 0 are colored green. Values = 0 are colored black.
strFile | Specifies the file where the image is saved. |
bNonZeroExistOnly | Optionally, specifies to color whether data exists as nonZero only (default = true). |
bSaveDiff | Optionally, specifies to save the diff instead of the data (default = false). |
rgSpecialValues | Optionally, specifies special values with associated colors. |
void MyCaffe.common.Blob< T >.SaveToNumpy | ( | string | strFile, |
bool | bSaveDiff = false |
||
) |
Save a blob with data to a Numpy .npy file.
strFile | Specifies the .npy file name where the data is saved. |
bSaveDiff | Specifies to save the diff, when false, the data is saved. |
|
static |
Save a blob with data to a Numpy .npy file.
strFile | Specifies the .npy file name where the data is saved. |
rgData | Specifies the data to be saved. |
rgShape | Specifies the shape of the data to be saved. |
|
static |
Save a blob with data to a Numpy .npy file.
strFile | Specifies the .npy file name where the data is saved. |
rgData | Specifies the data to be saved. |
rgShape | Specifies the shape of the data to be saved. |
|
static |
Save a blob with data to a Numpy .npy file.
strFile | Specifies the .npy file name where the data is saved. |
rgData | Specifies the data to be saved. |
rgShape | Specifies the shape of the data to be saved. |
void MyCaffe.common.Blob< T >.scale_data | ( | double | df | ) |
void MyCaffe.common.Blob< T >.scale_data | ( | T | fScaleFactor | ) |
void MyCaffe.common.Blob< T >.scale_diff | ( | double | df | ) |
void MyCaffe.common.Blob< T >.scale_diff | ( | T | fScaleFactor | ) |
void MyCaffe.common.Blob< T >.scale_to_range | ( | double | dfMin, |
double | dfMax | ||
) |
void MyCaffe.common.Blob< T >.SetCPUData | ( | T[] | rg | ) |
void MyCaffe.common.Blob< T >.SetData | ( | double | dfVal, |
int | nIdx = -1 |
||
) |
void MyCaffe.common.Blob< T >.SetData | ( | double | dfVal, |
int | nStartIdx, | ||
int | nCount | ||
) |
void MyCaffe.common.Blob< T >.SetData | ( | SimpleDatum | d, |
bool | bReshape, | ||
bool | bCopyData = true |
||
) |
void MyCaffe.common.Blob< T >.SetData | ( | T | fVal, |
int | nIdx = -1 |
||
) |
void MyCaffe.common.Blob< T >.SetData | ( | T[] | rgData, |
int | nCount = -1 , |
||
bool | bSetCount = true |
||
) |
Sets a number of items within the Blob's data.
rgData | Specifies the data to set. |
nCount | Optionally, specifies a subset count of items to set. |
bSetCount | Optionally, specifies whether or not to set the count. The count is always set when re-allocating the buffer. |
void MyCaffe.common.Blob< T >.SetDiff | ( | double | dfVal, |
int | nIdx = -1 |
||
) |
void MyCaffe.common.Blob< T >.SetDiff | ( | double | dfVal, |
int | nStartIdx, | ||
int | nCount | ||
) |
void MyCaffe.common.Blob< T >.SetDiff | ( | T[] | rgDiff, |
int | nCount = -1 , |
||
bool | bSetCount = true |
||
) |
Sets a number of items within the Blob's diff.
rgDiff | Specifies the diff to set. |
nCount | Optionally, specifies a subset count of items to set. |
bSetCount | Optionally, specifies whether or not to set the count. The count is always set when re-allocating the buffer. |
void MyCaffe.common.Blob< T >.SetParameter | ( | string | strName, |
double | dfVal | ||
) |
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.
nX | Specifies the x pixel within the image. |
nY | Specifies the y pxiel within the image. |
R | Specifies the color for the Red color channel. |
G | Specifies the color for the Green color channel. |
B | Specifies the color for the Blue color channel. |
order | Optionally, specifies the color ordering RGB or BGR (default = RGB). |
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.
nX | Specifies the x pixel within the image. |
nY | Specifies the y pxiel within the image. |
pixel | Specifies the color values for RED, GREEN and BLUE. |
bReturnOriginal | Optionally, specifies to return the original pixel. |
order | Optionally, specifies the color ordering RGB or BGR (default = RGB). |
nOffset | Optionally, specifies the offset to start at (default = 0). |
List< int > MyCaffe.common.Blob< T >.shape | ( | ) |
int MyCaffe.common.Blob< T >.shape | ( | int | nIdx | ) |
bool MyCaffe.common.Blob< T >.ShapeEquals | ( | BlobProto | bp | ) |
void MyCaffe.common.Blob< T >.Share | ( | Blob< T > | b | ) |
void MyCaffe.common.Blob< T >.ShareData | ( | Blob< T > | b | ) |
void MyCaffe.common.Blob< T >.ShareDiff | ( | Blob< T > | b | ) |
double MyCaffe.common.Blob< T >.std | ( | double? | dfMean = null , |
float[] | rgDf = null |
||
) |
Calculate the standard deviation of the blob data.
dfMean | Optionally, specifies the mean to use (default = null). |
rgDf | Optionally, specifies the CPU data to calculate the std on (default = null). |
double MyCaffe.common.Blob< T >.sum | ( | float[] | rgDf = null , |
bool | bDiff = false |
||
) |
T MyCaffe.common.Blob< T >.sumsq_data | ( | ) |
T MyCaffe.common.Blob< T >.sumsq_diff | ( | ) |
byte[] MyCaffe.common.Blob< T >.ToByteArray | ( | ) |
Datum MyCaffe.common.Blob< T >.ToDatum | ( | ) |
BlobProto MyCaffe.common.Blob< T >.ToProto | ( | bool | bWriteDiff = false | ) |
string MyCaffe.common.Blob< T >.ToSizeString | ( | ) |
override string MyCaffe.common.Blob< T >.ToString | ( | ) |
string MyCaffe.common.Blob< T >.ToString | ( | int | nMax, |
bool | bDiff = false |
||
) |
void MyCaffe.common.Blob< T >.Unsqueeze | ( | int | nNumAxes | ) |
void MyCaffe.common.Blob< T >.Update | ( | ) |
T[] MyCaffe.common.Blob< T >.update_cpu_data | ( | ) |
T[] MyCaffe.common.Blob< T >.update_cpu_diff | ( | ) |
bool MyCaffe.common.Blob< T >.ValidateData | ( | Blob< T > | work, |
bool | bDiff = false |
||
) |
|
static |
|
get |
|
get |
|
get |
|
get |
|
get |
Returns the SyncedMemory that stores the data.
|
get |
Returns the SyncedMemory that stores the diff.
|
get |
|
getset |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
get |
|
staticget |
|
getset |
|
getset |
|
get |
|
get |
|
getset |
|
get |
|
get |
|
get |
|
staticget |
|
getset |
|
getset |
|
get |
|
getset |
|
getset |
|
getset |
|
get |
|
staticget |