Operator

template<class Context>
class Operator : public dragon::OperatorBase

The base operator class with context.

Constructors

inline dragon::Operator::Operator(
  const OperatorDef &def,
  Workspace *ws)

Constructor.

Public Properties

arg

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

Return the specified argument.

args

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

Return all arguments.

data_format

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

Return the data format.

data_type

inline const string &dragon::Operator::data_type() const

Return the data type.

def

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

Return the operator def.

name

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

Return the operator name.

phase

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

Return the running phase.

type

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

Return the operator type.

workspace

inline Workspace *dragon::Operator::workspace() const

Return the parent workspace.

Public Functions

DeriveFrom

OperatorBase *dragon::Operator::DeriveFrom(const OperatorDef &def)

Derive a new operator from the base.

Fuse

inline virtual void dragon::Operator::Fuse(void *graph)

Fusion operator into the given graph.

GetArgument

template<typename T>
T dragon::Operator::GetArgument(const string &name)

Return the value of argument.

GetArgument

template<typename T>
T dragon::Operator::GetArgument(
  const string &name,
  const T &default_value)

Return the value of argument with default.

Input

Tensor &dragon::Operator::Input(int index)

Return the input tensor by index.

Input

Tensor &dragon::Operator::Input(const string &name)

Return the input tensor by name.

InputSize

inline int dragon::Operator::InputSize()

Return the number of inputs.

MessageForUnsupported

inline string dragon::Operator::MessageForUnsupported(
  const string &value,
  const vector<string> &support_values,
  const string &entry = "type") const

Return the message for supported value.

Output

Tensor *dragon::Operator::Output(int index)

Return the output tensor by index.

Output

Tensor *dragon::Operator::Output(
  int index,
  const vector<int> &inputs_at)

Return the output tensor by index with input aliases.

Output

Tensor *dragon::Operator::Output(const string &name)

Return the output tensor by name.

OutputSize

inline int dragon::Operator::OutputSize()

Return the number of outputs.

Run

inline virtual void dragon::Operator::Run(
  int stream = 0,
  bool sync = false) final

Run this operator.