NameSupply can be used to generate unique names.
More...
#include <name_supply.h>
NameSupply can be used to generate unique names.
◆ NameSupplyNode() [1/2]
tvm::NameSupplyNode::NameSupplyNode |
( |
| ) |
|
|
default |
Empty constructor. Needed by the TVM_REGISTER_NODE_TYPE macro.
◆ NameSupplyNode() [2/2]
tvm::NameSupplyNode::NameSupplyNode |
( |
const String & |
prefix, |
|
|
std::unordered_map< std::string, int > |
name_map |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
prefix | The prefix to be used with this NameSupply. |
name_map | The map used to guarantee uniqueness. |
◆ ContainsName()
bool tvm::NameSupplyNode::ContainsName |
( |
const String & |
name, |
|
|
bool |
add_prefix = true |
|
) |
| |
Checks if this NameSupply already generated a name.
- Parameters
-
name | The name to check. |
add_prefix | If set to true, then the prefix of this NameSupply will be prepended to the name before checking for it. |
- Returns
- True if the name has already been generated. False otherwise.
◆ FreshName()
String tvm::NameSupplyNode::FreshName |
( |
const String & |
name, |
|
|
bool |
add_prefix = true , |
|
|
bool |
add_underscore = true |
|
) |
| |
Generates a unique name from this NameSupply.
- Parameters
-
name | The name from which the generated name is derived. |
add_prefix | If set to true, then the prefix of this NameSupply will be prepended to the name. |
add_underscore | If set to true, add '_' between prefix and a digit. |
- Returns
- A unique name.
◆ ReserveName()
String tvm::NameSupplyNode::ReserveName |
( |
const String & |
name, |
|
|
bool |
add_prefix = true |
|
) |
| |
Reserves an existing name with this NameSupply.
- Parameters
-
name | The name to be reserved. |
add_prefix | If set to true, then the prefix of this NameSupply will be prepended to the name before reserving it. |
- Returns
- The name that was reserved with the NameSupply. It can be different if a prefix is added.
◆ TVM_DECLARE_FINAL_OBJECT_INFO()
◆ VisitAttrs()
void tvm::NameSupplyNode::VisitAttrs |
( |
AttrVisitor * |
v | ) |
|
|
inline |
◆ _type_has_method_sequal_reduce
constexpr const bool tvm::NameSupplyNode::_type_has_method_sequal_reduce = false |
|
staticconstexpr |
◆ _type_has_method_shash_reduce
constexpr const bool tvm::NameSupplyNode::_type_has_method_shash_reduce = false |
|
staticconstexpr |
◆ _type_key
constexpr const char* tvm::NameSupplyNode::_type_key = "NameSupply" |
|
staticconstexpr |
◆ prefix_
std::string tvm::NameSupplyNode::prefix_ |
The documentation for this class was generated from the following file: