Class OperatorNodeConfig

Inheritance Relationships

Base Type

  • public Hashable

Class Documentation

class mgb::cg::OperatorNodeConfig : public Hashable

configuration for operator nodes

Public Types

using CompNodeArray = SmallVector<CompNode, 1>

Public Functions

OperatorNodeConfig() = default
~OperatorNodeConfig()
OperatorNodeConfig(std::string name)
OperatorNodeConfig(const CompNode &cn)
OperatorNodeConfig(std::string name, const CompNode &cn, DType dtype = {})
OperatorNodeConfig(DType dtype)
std::string make_name(std::string default_name, const VarNodeArrayView &input_var, size_t opr_id) const

make a name according to default name and input vars

OperatorNodeConfig &name(std::string name)

set node name

const Maybe<std::string> &name() const
template<typename T>
OperatorNodeConfig &update_instance_id(const T &p)

update instance ID

Instance ID is a hashed value used to differentiate multiple instances of the same operator (with same inputs, params and config), so the deduplication system can be bypassed.

This method always updates underlying instance_id.

OperatorNodeConfig &reset_instance_id()

reset instance ID to the initial value

size_t instance_id() const

get current hashed instance ID

OperatorNodeConfig &comp_node(const CompNode &node)

set preferred single comp node

OperatorNodeConfig &comp_node_arr(const CompNodeArray &arr)

directly set all the CompNodes

CompNode get_single_comp_node() const

get single comp node if the user has set it, or an invalid comp node if the config is empty

OperatorNodeConfig &follow_comp_node(const SymbolVar &dest)

follow the computing node of dest

OperatorNodeConfig &output_dtype(DType dtype)
DType output_dtype() const
bool has_comp_node_set() const

whether at least one comp node has been set

const CompNodeArray &comp_node() const
size_t hash() const override
bool is_same_st(const Hashable &rhs) const override