Struct Instruction

Inheritance Relationships

Base Type

  • public common::Shared< _Instruction_ >

Struct Documentation

struct cinn::frontend::Instruction : public common::Shared<_Instruction_>

Instruction is the basic computational unit of a Program, similar to the operator concept in a DNN platform.

Public Functions

Instruction(absl::string_view op_type, const std::vector<Variable> &inputs = {}, Program *parent = nullptr)
void SetInputs(const std::vector<Variable> &vars)

Set the inputs of the instruction.

Parameters
  • vars: The input variables.

const std::vector<Variable> &GetOutputs() const
const Variable &GetOutput(size_t offset) const
template<typename T>
void SetAttr(const std::string &key, const T &v)

Set an attribute of the instruction.

Template Parameters
  • T: The type of the attribute value type.

Parameters
  • key: The identifier of the attribute.

  • v: The value of the attribute.

template<typename T>
T GetAttrs(const std::string &key) const

Get an attribute of the instruction.

Return

The attribute value.

Template Parameters
  • T: The data type of the attribute value.

Parameters
  • key: The identifier of the attribute.