tvm
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
tvm::UniqueNameSupplyNode Class Reference

UniqueNameSupply can be used to generate unique names. More...

#include <unique_name_supply.h>

Inheritance diagram for tvm::UniqueNameSupplyNode:
Collaboration diagram for tvm::UniqueNameSupplyNode:

Public Member Functions

 UniqueNameSupplyNode ()=default
 Empty constructor. Needed by the TVM_REGISTER_NODE_TYPE macro. More...
 
 UniqueNameSupplyNode (const ffi::String &prefix, ffi::Map< ffi::String, int64_t > name_map)
 Constructor. More...
 
ffi::String FreshName (const ffi::String &name, bool add_prefix=true, bool add_underscore=true)
 Generates a unique name from this UniqueNameSupply. More...
 
ffi::String ReserveName (const ffi::String &name, bool add_prefix=true)
 Reserves an existing name with this UniqueNameSupply. More...
 
bool ContainsName (const ffi::String &name, bool add_prefix=true)
 Checks if this UniqueNameSupply already generated a name. More...
 
 TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("ir.UniqueNameSupply", UniqueNameSupplyNode, ffi::Object)
 

Static Public Member Functions

static void RegisterReflection ()
 

Public Attributes

std::string prefix_
 

Static Public Attributes

static constexpr const bool _type_mutable = true
 

Detailed Description

UniqueNameSupply can be used to generate unique names.

Constructor & Destructor Documentation

◆ UniqueNameSupplyNode() [1/2]

tvm::UniqueNameSupplyNode::UniqueNameSupplyNode ( )
default

Empty constructor. Needed by the TVM_REGISTER_NODE_TYPE macro.

◆ UniqueNameSupplyNode() [2/2]

tvm::UniqueNameSupplyNode::UniqueNameSupplyNode ( const ffi::String &  prefix,
ffi::Map< ffi::String, int64_t >  name_map 
)
inline

Constructor.

Parameters
prefixThe prefix to be used with this UniqueNameSupply.
name_mapThe map used to guarantee uniqueness.

Member Function Documentation

◆ ContainsName()

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

Checks if this UniqueNameSupply already generated a name.

Parameters
nameThe name to check.
add_prefixIf 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.

◆ FreshName()

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

Generates a unique name from this UniqueNameSupply.

Parameters
nameThe name from which the generated name is derived.
add_prefixIf set to true, then the prefix of this UniqueNameSupply will be prepended to the name.
add_underscoreIf set to true, add '_' between prefix and a digit.
Returns
A unique name.

◆ RegisterReflection()

static void tvm::UniqueNameSupplyNode::RegisterReflection ( )
inlinestatic

◆ ReserveName()

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

Reserves an existing name with this UniqueNameSupply.

Parameters
nameThe name to be reserved.
add_prefixIf 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.

◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()

tvm::UniqueNameSupplyNode::TVM_FFI_DECLARE_OBJECT_INFO_FINAL ( "ir.UniqueNameSupply"  ,
UniqueNameSupplyNode  ,
ffi::Object   
)

Member Data Documentation

◆ _type_mutable

constexpr const bool tvm::UniqueNameSupplyNode::_type_mutable = true
staticconstexpr

◆ prefix_

std::string tvm::UniqueNameSupplyNode::prefix_

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