tvm_tirx.ir.unique_name_supply.UniqueNameSupply#

class tvm_tirx.ir.unique_name_supply.UniqueNameSupply(prefix='')#

Bases: Object

UniqueNameSupply that can be used to generate unique names.

Parameters:

prefix (The prefix to be added to the generated names.)

fresh_name(name, add_prefix=True, add_underscore=True)#

Generates a unique name from this UniqueNameSupply.

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

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

  • add_underscore (bool) – If set to True, adds ‘_’ between prefix and digit.

reserve_name(name, add_prefix=True)#

Reserves an existing name with this UniqueNameSupply.

Parameters:
  • name (String) – The name to be reserved.

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

contains_name(name, add_prefix=True)#

Checks if this UniqueNameSupply already generated a name.

Parameters:
  • name (String) – The name to check.

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