Caffe2 - C++ API
A deep learning, cross platform ML framework
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
caffe2::GradientMakerBase Class Reference
Inheritance diagram for caffe2::GradientMakerBase:
caffe2::AbstractReduceBackDef< T, Context, ReducerDef >::GetGradient caffe2::AbstractReduceFrontDef< T, Context, ReducerDef >::GetGradient caffe2::AbstractSortedSegmentRangeDef< T, SIndex, Context, ReducerDef >::GetGradient caffe2::GetAbsGradient caffe2::GetAddPaddingGradient caffe2::GetAffineChannelGradient caffe2::GetAveragedLossGradient caffe2::GetBatchGatherGradient caffe2::GetBatchPermutationGradient caffe2::GetBatchToSpaceGradient caffe2::GetCastGradient caffe2::GetChannelShuffleGradient caffe2::GetCol2ImGradient caffe2::GetColwiseMaxGradient caffe2::GetConcatGradient caffe2::GetConvGradient caffe2::GetConvTransposeGradient caffe2::GetCosGradient caffe2::GetCosineSimilarityGradient caffe2::GetCrossEntropyGradient caffe2::GetDotProductGradient caffe2::GetDotProductWithPaddingGradient caffe2::GetDropoutGradient caffe2::GetElementwiseLinearGradient caffe2::GetEluGradient caffe2::GetExpGradient caffe2::GetFCDecompGradient caffe2::GetFlattenGradient caffe2::GetFloatToHalfGradient caffe2::GetGroupSpatialSoftmaxGradient caffe2::GetGRUUnitGradient caffe2::GetHalfToFloatGradient caffe2::GetIm2ColGradient caffe2::GetInstanceNormGradient caffe2::GetL1DistanceGradient caffe2::GetLabelCrossEntropyGradient caffe2::GetLeakyReluGradient caffe2::GetLogGradient caffe2::GetLRNGradient caffe2::GetLSTMUnitGradient caffe2::GetMakeTwoClassGradient caffe2::GetMatMulGradient caffe2::GetMaxGradient caffe2::GetMinGradient caffe2::GetNanCheckGradient caffe2::GetNCHW2NHWCGradient caffe2::GetNegateGradientGradient caffe2::GetNegativeGradient caffe2::GetNHWC2NCHWGradient caffe2::GetNormalizeGradient caffe2::GetPackSegmentsGradient caffe2::GetPadImageGradient caffe2::GetPoolGradient caffe2::GetPoolGradient caffe2::GetPReluGradient caffe2::GetPrependDimGradient caffe2::GetRecurrentGradient caffe2::GetRecurrentNetworkGradient caffe2::GetReduceBackMaxGradient caffe2::GetReduceBackMeanGradient caffe2::GetReduceBackSumGradient caffe2::GetReduceFrontMaxGradient caffe2::GetReduceFrontMeanGradient caffe2::GetReduceFrontSumGradient caffe2::GetReluGradient caffe2::GetRemovePaddingGradient caffe2::GetReshapeGradient caffe2::GetResizeNearestGradient caffe2::GetReversePackedSegsGradient caffe2::GetRoIPoolGradient caffe2::GetRowwiseMaxGradient caffe2::GetSampleAsGradient caffe2::GetScaleGradient caffe2::GetSelectSmoothL1LossGradient caffe2::GetSeluGradient caffe2::GetSigmoidCrossEntropyLossGradient caffe2::GetSigmoidCrossEntropyWithLogitsGradient caffe2::GetSigmoidFocalLossGradient caffe2::GetSigmoidGradient caffe2::GetSinGradient caffe2::GetSmoothL1LossGradient caffe2::GetSoftmaxFocalLossGradient caffe2::GetSoftmaxGradient caffe2::GetSoftplusGradient caffe2::GetSoftsignGradient caffe2::GetSpaceToBatchGradient caffe2::GetSpatialBNGradient caffe2::GetSplitGradient caffe2::GetSqrGradient caffe2::GetSquaredL2DistanceGradient caffe2::GetSquareRootDivideGradient caffe2::GetSumElementsGradient caffe2::GetSwishGradient caffe2::GetTanhGradient caffe2::GetTileGradient caffe2::GetTopKGradient caffe2::GetTransposeGradient caffe2::GetUnpackSegmentsGradient caffe2::GetUpsampleNearestGradient caffe2::GetWeightedSigmoidCrossEntropyWithLogitsGradient caffe2::GetZeroGradientOpGradient caffe2::GradientNotImplementedYet caffe2::LengthsOpGetGradient< ForwardOp, ReducerDef, ReducerGradient, SparseFused, GradientNeedIndices > caffe2::NoGradient caffe2::SegmentOpGetGradient< ForwardOp, ReducerDef, ReducerGradient, Sorted, SparseFused > caffe2::SpatialNarrowAsGradient caffe2::ThrowInTheTowelIfGradientIsCalled

Public Member Functions

 GradientMakerBase (const OperatorDef &def, const vector< GradientWrapper > &g_output)
 
virtual bool CopyDeviceOption () const
 
virtual bool CopyEngine () const
 
virtual bool CopyArguments () const
 
virtual void VerifyOp () const
 
virtual GradientOpsMeta Get ()
 Returns the gradient ops meta. More...
 
const OperatorDef & Def () const
 

Static Public Member Functions

static CaffeMap< string, string > MatchGradsToParams (const OperatorDef &op)
 Returns map that returns the parameters that the gradients are for.
 

Protected Member Functions

virtual vector< OperatorDef > GetGradientDefs ()
 
string I (const int i)
 
string O (const int i)
 
string GI (const int i)
 
string GI_I (const int i)
 
string GI_V (const int i)
 
string GO (const int i)
 
string GO_I (const int i)
 
string GO_V (const int i)
 
const GradientWrapperGradOut (int i)
 
void SetDense (const int i, const string &name)
 
void SetSparse (const int i, const string &indices, const string &values)
 

Static Protected Member Functions

template<class... Args>
static vector< OperatorDef > SingleGradientDef (const Args &...args)
 a helper function to allow one to create one single operator def, which is usually the case for many simple operators.
 

Protected Attributes

const OperatorDef & def_
 
const vector< GradientWrapper > & g_output_
 
vector< GradientWrapperg_input_
 

Detailed Description

Definition at line 63 of file operator_gradient.h.

Member Function Documentation

virtual GradientOpsMeta caffe2::GradientMakerBase::Get ( )
inlinevirtual

Returns the gradient ops meta.

If your gradient op generator only use standard input and output manipulations, you can simply implement GetGradientDefs() that returns vector<OperatorDef>. In that, you can call GI, GI_V and GI_I that will automatically create the gradient registration for you.

If you need to do custom gradient name registration, overload this function directly.

Reimplemented in caffe2::GradientNotImplementedYet, and caffe2::ThrowInTheTowelIfGradientIsCalled.

Definition at line 101 of file operator_gradient.h.


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