Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
Public Types | Public Member Functions | Protected Attributes | List of all members
dragon::OperatorBase Class Reference

#include <operator.h>

Inheritance diagram for dragon::OperatorBase:
dragon::Operator< Context > 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 Types

typedef Map< string, vector< OperatorBase * > > SubGraph
 

Public Member Functions

 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 Run (int stream_id=0)
 Run this operator on the specified stream. 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

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_
 

Member Typedef Documentation

◆ SubGraph

typedef Map<string, vector<OperatorBase*> > dragon::OperatorBase::SubGraph

Constructor & Destructor Documentation

◆ OperatorBase()

dragon::OperatorBase::OperatorBase ( const OperatorDef &  def,
Workspace ws 
)

Default constructor.

◆ ~OperatorBase()

virtual dragon::OperatorBase::~OperatorBase ( )
inlinevirtual

Default deconstructor.

Member Function Documentation

◆ anchor()

const string& dragon::OperatorBase::anchor ( ) const
inline

Return the anchor name of this operator.

◆ Arg()

template<typename T >
T dragon::OperatorBase::Arg ( const string &  name,
const T &  default_value 
)

Return the value of the specified argument.

◆ arg()

const Argument& dragon::OperatorBase::arg ( const string &  name)
inline

Return the specified argument.

◆ Args()

template<typename T >
vector<T> dragon::OperatorBase::Args ( const string &  name)

Return the values of the specified argument.

◆ args()

const Map<std::string, const Argument*>& dragon::OperatorBase::args ( )
inline

Return the argument map of this operator.

◆ data_format()

const string& dragon::OperatorBase::data_format ( ) const
inline

Return the data format of this operator.

◆ DebugString()

string dragon::OperatorBase::DebugString ( ) const
inline

Return the debug string of the stored operator def.

◆ def()

const OperatorDef& dragon::OperatorBase::def ( ) const
inline

Return the stored operator def.

◆ dtype()

const string& dragon::OperatorBase::dtype ( ) const
inline

Return the data type of this operator.

◆ DTypeString() [1/2]

string dragon::OperatorBase::DTypeString ( const Tensor tensor,
const Set< string > &  dtypes 
) const

Return the dtype string according to given tensor.

◆ DTypeString() [2/2]

string dragon::OperatorBase::DTypeString ( const string &  dtype,
const Set< string > &  dtypes 
) const

◆ Fusion()

virtual void dragon::OperatorBase::Fusion ( void *  graph)
inlinevirtual

Fusion this operator into the specified graph.

◆ name()

const string& dragon::OperatorBase::name ( ) const
inline

Return the operator name.

◆ phase()

const string& dragon::OperatorBase::phase ( ) const
inline

Return the current running phase.

◆ Run()

virtual void dragon::OperatorBase::Run ( int  stream_id = 0)
inlinevirtual

Run this operator on the specified stream.

Reimplemented in dragon::Operator< Context >.

◆ set_subgraph()

void dragon::OperatorBase::set_subgraph ( SubGraph  subgraph)
inline

Set the given recomputing subgraph.

◆ subgraph()

SubGraph& dragon::OperatorBase::subgraph ( )
inline

Return the recomputing subgraph of this operator.

◆ SwitchToPhase()

void dragon::OperatorBase::SwitchToPhase ( const string &  phase)
inline

Switch the internal running phase.

◆ type()

const string& dragon::OperatorBase::type ( ) const
inline

Return the operator type.

◆ unique_name()

const string dragon::OperatorBase::unique_name ( const string &  name) const
inline

Return the unique name in this operator.

◆ UpdateFrom()

void dragon::OperatorBase::UpdateFrom ( const OperatorDef &  def)

Modify this operator according to the given def.

◆ ws()

Workspace* dragon::OperatorBase::ws ( ) const
inline

Return the parent workspace.

◆ X()

Tensor & dragon::OperatorBase::X ( int  i)

Return the specified input tensor.

◆ XSize()

int dragon::OperatorBase::XSize ( )
inline

Return the number of inputs.

◆ Y()

Tensor * dragon::OperatorBase::Y ( int  i)

Return the specified output tensor.

◆ YSize()

int dragon::OperatorBase::YSize ( )
inline

Return the number of outputs.

Member Data Documentation

◆ anchor_

string dragon::OperatorBase::anchor_
protected

◆ args_

Map<string, const Argument*> dragon::OperatorBase::args_
protected

◆ data_format_

string dragon::OperatorBase::data_format_
protected

◆ def_

OperatorDef dragon::OperatorBase::def_
protected

◆ dtype_

string dragon::OperatorBase::dtype_
protected

◆ inputs_

vector<Tensor*> dragon::OperatorBase::inputs_
protected

◆ outputs_

vector<Tensor*> dragon::OperatorBase::outputs_
protected

◆ phase_

string dragon::OperatorBase::phase_
protected

◆ subgraph_

SubGraph dragon::OperatorBase::subgraph_
protected

◆ ws_

Workspace* dragon::OperatorBase::ws_
protected

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