Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Public Member Functions | Protected Attributes | List of all members
dragon::Operator< Context > Class Template Referenceabstract

#include <operator.h>

Inheritance diagram for dragon::Operator< Context >:
dragon::OperatorBase dragon::AccumulateOp< Context > dragon::AccuracyOp< Context > dragon::AffineGradientOp< Context > dragon::AffineOp< Context > dragon::ArangeOp< Context > dragon::ArgReduceOp< Context > dragon::AssignOp< Context > dragon::BatchNormGradientOp< Context > dragon::BatchNormOp< Context > dragon::BiasAddGradientOp< Context > dragon::BiasAddOp< Context > dragon::BilinearResizeGradientOp< Context > dragon::BilinearResizeOp< Context > dragon::CastGradientOp< Context > dragon::CastOp< Context > dragon::ClipGradientOp< Context > dragon::ClipOp< Context > dragon::CompareOp< Context > dragon::ConcatGradientOp< Context > dragon::ConcatOp< Context > dragon::ConvOpBase< Context > dragon::CopyOp< Context > dragon::CropGradientOp< Context > dragon::CropOp< Context > dragon::CTCLossGradientOp< Context > dragon::CTCLossOp< Context > dragon::CuDNNBiasAddGradientOp< Context > dragon::CuDNNBiasAddOp< Context > dragon::CuDNNSoftmaxGradientOp< Context > dragon::CuDNNSoftmaxOp< Context > dragon::DimGradientOpBase< Context > dragon::DimOpBase< Context > dragon::DotGradientOp< Context > dragon::DotOp< Context > dragon::DropBlock2dGradientOp< Context > dragon::DropBlock2dOp< Context > dragon::DropoutGradientOp< Context > dragon::DropoutOp< Context > dragon::DropPathGradientOp< Context > dragon::DropPathOp< Context > dragon::EltwiseGradientOp< Context > dragon::EltwiseOp< Context > dragon::EluGradientOp< Context > dragon::EluOp< Context > dragon::ExpGradientOp< Context > dragon::ExpOp< Context > dragon::FillOp< Context > dragon::FullyConnectedGradientOp< Context > dragon::FullyConnectedOp< Context > dragon::GivenTensorFillOp< Context > dragon::GradientAddOp< Context > dragon::GradientGatherOp< Context > dragon::GradientGenerateOp< Context > dragon::GramMatrixGradientOp< Context > dragon::GramMatrixOp< Context > dragon::GroupNormGradientOp< Context > dragon::GroupNormOp< Context > dragon::ImageDataOp< Context > dragon::IndexSelectGradientOp< Context > dragon::IndexSelectOp< Context > dragon::InitializeOp< Context > dragon::L1LossGradientOp< Context > dragon::L1LossOp< Context > dragon::L2LossGradientOp< Context > dragon::L2LossOp< Context > dragon::L2NormGradientOp< Context > dragon::L2NormOp< Context > dragon::LogGradientOp< Context > dragon::LogOp< Context > dragon::LRNGradientOp< Context > dragon::LRNOp< Context > dragon::LSTMCellGradientOp< Context > dragon::LSTMCellOp< Context > dragon::MaskedAssignOp< Context > dragon::MaskedSelectGradientOp< Context > dragon::MaskedSelectOp< Context > dragon::MatmulGradientOp< Context > dragon::MatmulOp< Context > dragon::MaximumGradientOp< Context > dragon::MaximumOp< Context > dragon::MinimumGradientOp< Context > dragon::MinimumOp< Context > dragon::MomentsOp< Context > dragon::MPIOpBase< Context > dragon::MultinomialOp< Context > dragon::NLLLossGradientOp< Context > dragon::NLLLossOp< Context > dragon::NNResizeGradientOp< Context > dragon::NNResizeOp< Context > dragon::NonZeroOp< Context > dragon::OneHotOp< Context > dragon::PadGradientOp< Context > dragon::PadOp< Context > dragon::Pool2dGradientOp< Context > dragon::Pool2dOp< Context > dragon::PowGradientOp< Context > dragon::PowOp< Context > dragon::PReluGradientOp< Context > dragon::PReluOp< Context > dragon::ProposalOp< Context > dragon::RecurrentGradientOp< Context > dragon::RecurrentOp< Context > dragon::ReduceGradientOp< Context > dragon::ReduceOp< Context > dragon::ReluGradientOp< Context > dragon::ReluOp< Context > dragon::RepeatGradientOp< Context > dragon::RepeatOp< Context > dragon::RNNParamSetOp< Context > dragon::ROIAlignGradientOp< Context > dragon::ROIAlignOp< Context > dragon::ROIPoolGradientOp< Context > dragon::ROIPoolOp< Context > dragon::SEluGradientOp< Context > dragon::SEluOp< Context > dragon::ShapeOp< Context > dragon::SigmoidCrossEntropyGradientOp< Context > dragon::SigmoidCrossEntropyOp< Context > dragon::SigmoidFocalLossGradientOp< Context > dragon::SigmoidFocalLossOp< Context > dragon::SigmoidGradientOp< Context > dragon::SigmoidOp< Context > dragon::SliceGradientOp< Context > dragon::SliceOp< Context > dragon::SmoothL1LossGradientOp< Context > dragon::SmoothL1LossOp< Context > dragon::SoftmaxCrossEntropyGradientOp< Context > dragon::SoftmaxCrossEntropyOp< Context > dragon::SoftmaxGradientOp< Context > dragon::SoftmaxOp< Context > dragon::SparseSoftmaxCrossEntropyGradientOp< Context > dragon::SparseSoftmaxCrossEntropyOp< Context > dragon::SqrtGradientOp< Context > dragon::SqrtOp< Context > dragon::SquareGradientOp< Context > dragon::SquareOp< Context > dragon::StackGradientOp< Context > dragon::StackOp< Context > dragon::StopGradientOp< Context > dragon::TanhGradientOp< Context > dragon::TanhOp< Context > dragon::TileGradientOp< Context > dragon::TileOp< Context > dragon::TransposeGradientOp< Context > dragon::TransposeOp< Context > dragon::UpdateOpBase< Context > dragon::WhereGradientOp< Context > dragon::WhereOp< Context >

Public Member Functions

 Operator (const OperatorDef &def, Workspace *ws)
 Default constructor. More...
 
void Run (int stream_id=0) final
 Run this operator on the specified stream. More...
 
virtual void PrepareResource ()
 Prepare the content of inputs. More...
 
virtual void ReleaseResource ()
 Release the ownership of inputs. More...
 
virtual void MemorySwitch ()
 Coordinate the context of inputs and outputs. More...
 
virtual void RunOnDevice ()=0
 Implement the detailed execution. More...
 
Context * ctx ()
 Return the internal context. More...
 
bool AllowRun ()
 Whether this operator can be ignored. More...
 
- Public Member Functions inherited from dragon::OperatorBase
 OperatorBase (const OperatorDef &def, Workspace *ws)
 Default constructor. More...
 
virtual ~OperatorBase ()
 Default deconstructor. More...
 
TensorX (int i)
 Return the specified input tensor. More...
 
TensorY (int i)
 Return the specified output tensor. More...
 
int XSize ()
 Return the number of inputs. More...
 
int YSize ()
 Return the number of outputs. More...
 
void UpdateFrom (const OperatorDef &def)
 Modify this operator according to the given def. More...
 
void SwitchToPhase (const string &phase)
 Switch the internal running phase. More...
 
virtual void Fusion (void *graph)
 Fusion this operator into the specified graph. More...
 
const string & name () const
 Return the operator name. More...
 
const string & type () const
 Return the operator type. More...
 
const string & phase () const
 Return the current running phase. More...
 
const string & anchor () const
 Return the anchor name of this operator. More...
 
const string & dtype () const
 Return the data type of this operator. More...
 
const string & data_format () const
 Return the data format of this operator. More...
 
const string unique_name (const string &name) const
 Return the unique name in this operator. More...
 
Workspacews () const
 Return the parent workspace. More...
 
template<typename T >
Arg (const string &name, const T &default_value)
 Return the value of the specified argument. More...
 
template<typename T >
vector< T > Args (const string &name)
 Return the values of the specified argument. More...
 
const Map< std::string, const Argument * > & args ()
 Return the argument map of this operator. More...
 
const Argument & arg (const string &name)
 Return the specified argument. More...
 
SubGraphsubgraph ()
 Return the recomputing subgraph of this operator. More...
 
void set_subgraph (SubGraph subgraph)
 Set the given recomputing subgraph. More...
 
const OperatorDef & def () const
 Return the stored operator def. More...
 
string DebugString () const
 Return the debug string of the stored operator def. More...
 
string DTypeString (const Tensor &tensor, const Set< string > &dtypes) const
 Return the dtype string according to given tensor. More...
 
string DTypeString (const string &dtype, const Set< string > &dtypes) const
 

Protected Attributes

Context ctx_
 Store the internal context. More...
 
bool allow_run_
 
bool allow_recomp_
 
bool do_sync_
 
- Protected Attributes inherited from dragon::OperatorBase
Workspacews_
 
OperatorDef def_
 
SubGraph subgraph_
 
string phase_
 
string anchor_
 
string dtype_
 
string data_format_
 
vector< Tensor * > inputs_
 
vector< Tensor * > outputs_
 
Map< string, const Argument * > args_
 

Additional Inherited Members

- Public Types inherited from dragon::OperatorBase
typedef Map< string, vector< OperatorBase * > > SubGraph
 

Constructor & Destructor Documentation

◆ Operator()

template<class Context >
dragon::Operator< Context >::Operator ( const OperatorDef &  def,
Workspace ws 
)
inline

Default constructor.

Member Function Documentation

◆ AllowRun()

template<class Context >
bool dragon::Operator< Context >::AllowRun ( )
inline

Whether this operator can be ignored.

◆ ctx()

template<class Context >
Context* dragon::Operator< Context >::ctx ( )
inline

Return the internal context.

◆ MemorySwitch()

template<class Context >
virtual void dragon::Operator< Context >::MemorySwitch ( )
inlinevirtual

Coordinate the context of inputs and outputs.

Reimplemented in dragon::DimOpBase< Context >.

◆ PrepareResource()

template<class Context >
template void dragon::Operator< Context >::PrepareResource ( )
virtual

Prepare the content of inputs.

◆ ReleaseResource()

template<class Context >
template void dragon::Operator< Context >::ReleaseResource ( )
virtual

Release the ownership of inputs.

◆ Run()

template<class Context >
void dragon::Operator< Context >::Run ( int  stream_id = 0)
inlinefinalvirtual

Run this operator on the specified stream.

Reimplemented from dragon::OperatorBase.

◆ RunOnDevice()

template<class Context >
virtual void dragon::Operator< Context >::RunOnDevice ( )
pure virtual

Implement the detailed execution.

Implemented in dragon::CuDNNPool2dGradientOp< Context >, dragon::CuDNNConvTranspose2dGradientOp< Context >, dragon::CuDNNLRNGradientOp< Context >, dragon::CuDNNConv2dGradientOp< Context >, dragon::CuDNNPool2dOp< Context >, dragon::SqueezeOp< Context >, dragon::CuDNNLRNOp< Context >, dragon::ExpandDimsOp< Context >, dragon::CuDNNDepthwiseConv2dGradientOp< Context >, dragon::CuDNNConvTranspose2dOp< Context >, dragon::Pool2dGradientOp< Context >, dragon::CuDNNReluGradientOp< Context >, dragon::CuDNNConv2dOp< Context >, dragon::CuDNNTanhGradientOp< Context >, dragon::FlattenOp< Context >, dragon::CuDNNSigmoidGradientOp< Context >, dragon::CuDNNSoftmaxGradientOp< Context >, dragon::CuDNNBiasAddGradientOp< Context >, dragon::CuDNNDepthwiseConv2dOp< Context >, dragon::GivenTensorFillOp< Context >, dragon::LRNGradientOp< Context >, dragon::StopGradientOp< Context >, dragon::CuDNNReluOp< Context >, dragon::SparseSoftmaxCrossEntropyGradientOp< Context >, dragon::EltwiseGradientOp< Context >, dragon::PadGradientOp< Context >, dragon::CuDNNSoftmaxOp< Context >, dragon::ReshapeOp< Context >, dragon::SigmoidFocalLossGradientOp< Context >, dragon::NLLLossGradientOp< Context >, dragon::SoftmaxFocalLossGradientOp< Context >, dragon::GradientAddOp< Context >, dragon::CuDNNBiasAddOp< Context >, dragon::CuDNNSigmoidOp< Context >, dragon::CuDNNTanhOp< Context >, dragon::BatchNormGradientOp< Context >, dragon::ROIAlignGradientOp< Context >, dragon::SoftmaxCrossEntropyGradientOp< Context >, dragon::ConvTranspose2dGradientOp< Context >, dragon::DropBlock2dGradientOp< Context >, dragon::Pool2dOp< Context >, dragon::NNResizeGradientOp< Context >, dragon::GroupNormGradientOp< Context >, dragon::BilinearResizeGradientOp< Context >, dragon::DepthwiseConv2dGradientOp< Context >, dragon::FullyConnectedGradientOp< Context >, dragon::PowGradientOp< Context >, dragon::CropGradientOp< Context >, dragon::SigmoidCrossEntropyGradientOp< Context >, dragon::DropoutGradientOp< Context >, dragon::SmoothL1LossGradientOp< Context >, dragon::GradientGatherOp< Context >, dragon::FillOp< Context >, dragon::L2NormGradientOp< Context >, dragon::DropPathGradientOp< Context >, dragon::L1LossGradientOp< Context >, dragon::L2LossGradientOp< Context >, dragon::Conv2dGradientOp< Context >, dragon::ROIPoolGradientOp< Context >, dragon::DotGradientOp< Context >, dragon::MatmulGradientOp< Context >, dragon::ReduceGradientOp< Context >, dragon::RepeatGradientOp< Context >, dragon::CollectiveUpdateOp< Context >, dragon::SliceGradientOp< Context >, dragon::AffineGradientOp< Context >, dragon::TileGradientOp< Context >, dragon::TransposeGradientOp< Context >, dragon::PReluGradientOp< Context >, dragon::ClipGradientOp< Context >, dragon::GramMatrixGradientOp< Context >, dragon::UpdateOpBase< Context >, dragon::SoftmaxGradientOp< Context >, dragon::ConcatGradientOp< Context >, dragon::IndexSelectGradientOp< Context >, dragon::EluGradientOp< Context >, dragon::ReluGradientOp< Context >, dragon::StackGradientOp< Context >, dragon::SparseSoftmaxCrossEntropyOp< Context >, dragon::ImageDataOp< Context >, dragon::MPIBroadcastGradientOp< Context >, dragon::MPIGatherGradientOp< Context >, dragon::RNNParamSetOp< Context >, dragon::LRNOp< Context >, dragon::MaskedSelectGradientOp< Context >, dragon::RecurrentGradientOp< Context >, dragon::EltwiseOp< Context >, dragon::CastGradientOp< Context >, dragon::ProposalOp< Context >, dragon::PadOp< Context >, dragon::CTCLossGradientOp< Context >, dragon::NLLLossOp< Context >, dragon::SigmoidFocalLossOp< Context >, dragon::SoftmaxFocalLossOp< Context >, dragon::BiasAddGradientOp< Context >, dragon::MaximumGradientOp< Context >, dragon::MinimumGradientOp< Context >, dragon::DimGradientOpBase< Context >, dragon::WhereGradientOp< Context >, dragon::LSTMCellGradientOp< Context >, dragon::SEluGradientOp< Context >, dragon::SigmoidGradientOp< Context >, dragon::TanhGradientOp< Context >, dragon::ExpGradientOp< Context >, dragon::LogGradientOp< Context >, dragon::SqrtGradientOp< Context >, dragon::SquareGradientOp< Context >, dragon::AccuracyOp< Context >, dragon::NNResizeOp< Context >, dragon::BatchNormOp< Context >, dragon::BilinearResizeOp< Context >, dragon::DropBlock2dOp< Context >, dragon::CropOp< Context >, dragon::SoftmaxCrossEntropyOp< Context >, dragon::ConvTranspose2dOp< Context >, dragon::DepthwiseConv2dOp< Context >, dragon::ROIAlignOp< Context >, dragon::DropoutOp< Context >, dragon::DropPathOp< Context >, dragon::PowOp< Context >, dragon::MultinomialOp< Context >, dragon::SigmoidCrossEntropyOp< Context >, dragon::GroupNormOp< Context >, dragon::ArangeOp< Context >, dragon::ArgReduceOp< Context >, dragon::AssignOp< Context >, dragon::L1LossOp< Context >, dragon::L2LossOp< Context >, dragon::SmoothL1LossOp< Context >, dragon::GradientGenerateOp< Context >, dragon::InitializeOp< Context >, dragon::L2NormOp< Context >, dragon::Conv2dOp< Context >, dragon::FullyConnectedOp< Context >, dragon::OneHotOp< Context >, dragon::ReduceOp< Context >, dragon::RepeatOp< Context >, dragon::MPIBroadcastOp< Context >, dragon::MPIGatherOp< Context >, dragon::ROIPoolOp< Context >, dragon::PReluOp< Context >, dragon::AccumulateOp< Context >, dragon::AffineOp< Context >, dragon::ClipOp< Context >, dragon::DotOp< Context >, dragon::MatmulOp< Context >, dragon::MomentsOp< Context >, dragon::SliceOp< Context >, dragon::TileOp< Context >, dragon::TransposeOp< Context >, dragon::CompareOp< Context >, dragon::CTCLossOp< Context >, dragon::RecurrentOp< Context >, dragon::EluOp< Context >, dragon::ReluOp< Context >, dragon::SoftmaxOp< Context >, dragon::GramMatrixOp< Context >, dragon::ConcatOp< Context >, dragon::IndexSelectOp< Context >, dragon::StackOp< Context >, dragon::CastOp< Context >, dragon::MaskedSelectOp< Context >, dragon::NonZeroOp< Context >, dragon::WhereOp< Context >, dragon::MaskedAssignOp< Context >, dragon::LSTMCellOp< Context >, dragon::SEluOp< Context >, dragon::SigmoidOp< Context >, dragon::TanhOp< Context >, dragon::ExpOp< Context >, dragon::LogOp< Context >, dragon::MaximumOp< Context >, dragon::MinimumOp< Context >, dragon::SqrtOp< Context >, dragon::SquareOp< Context >, dragon::CopyOp< Context >, dragon::BiasAddOp< Context >, and dragon::ShapeOp< Context >.

Member Data Documentation

◆ allow_recomp_

template<class Context >
bool dragon::Operator< Context >::allow_recomp_
protected

◆ allow_run_

template<class Context >
bool dragon::Operator< Context >::allow_run_
protected

◆ ctx_

template<class Context >
Context dragon::Operator< Context >::ctx_
protected

Store the internal context.

◆ do_sync_

template<class Context >
bool dragon::Operator< Context >::do_sync_
protected

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