generate

paddle.fluid.unique_name.generate(key)[source]

Generate unique name with prefix key. Currently, Paddle distinguishes the names of the same key by numbering it from zero. For example, when key=fc, it continuously generates fc_0, fc_1, fc_2, etc.

Parameters

key (str) – The prefix of generated name.

Returns

A unique string with the prefix key.

Return type

str

Examples

import paddle.fluid as fluid
name1 = fluid.unique_name.generate('fc')
name2 = fluid.unique_name.generate('fc')
print(name1, name2) # fc_0, fc_1