Class UniqueNameSupplyObj#

Inheritance Relationships#

Base Type#

  • public ffi::Object

Class Documentation#

class UniqueNameSupplyObj : public ffi::Object#

UniqueNameSupply can be used to generate unique names.

Public Functions

UniqueNameSupplyObj() = default#

Empty constructor. Needed by the TVM_REGISTER_NODE_TYPE macro.

inline UniqueNameSupplyObj(const ffi::String &prefix, ffi::Map<ffi::String, int64_t> name_map)#

Constructor.

Parameters:
  • prefix – The prefix to be used with this UniqueNameSupply.

  • name_map – The map used to guarantee uniqueness.

ffi::String FreshName(const ffi::String &name, bool add_prefix = true, bool add_underscore = true)#

Generates a unique name from this UniqueNameSupply.

Parameters:
  • name – The name from which the generated name is derived.

  • add_prefix – If set to true, then the prefix of this UniqueNameSupply will be prepended to the name.

  • add_underscore – If set to true, add ‘_’ between prefix and a digit.

Returns:

A unique name.

ffi::String ReserveName(const ffi::String &name, bool add_prefix = true)#

Reserves an existing name with this UniqueNameSupply.

Parameters:
  • name – The name to be reserved.

  • add_prefix – If set to true, then the prefix of this UniqueNameSupply will be prepended to the name before reserving it.

Returns:

The name that was reserved with the UniqueNameSupply. It can be different if a prefix is added.

bool ContainsName(const ffi::String &name, bool add_prefix = true)#

Checks if this UniqueNameSupply already generated a name.

Parameters:
  • name – The name to check.

  • add_prefix – If set to true, then the prefix of this UniqueNameSupply will be prepended to the name before checking for it.

Returns:

True if the name has already been generated. False otherwise.

Public Members

std::string prefix_#

Public Static Functions

static inline void RegisterReflection()#
static inline int32_t _GetOrAllocRuntimeTypeIndex()#
static inline int32_t RuntimeTypeIndex() noexcept#