microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Automatically generate unique torch module names #951

Open toelli-msft opened 3 years ago

toelli-msft commented 3 years ago

I believe there is no restriction on these identifiers other than that they are unique (and are valid C module names). It would be good if something internal could ensure uniqueness by keeping track of everything it has seen so far and appending a unique number (for example) if it sees the same identifier twice. Manually keeping them in sync with the function names is very easy to get wrong.

https://github.com/microsoft/knossos-ksc/blob/e1b3fcbb7f31836e063ea1dbc98a05037da3ab7f/examples/dl-activations/relu3.py#L61