1 #pragma once 2 3 #include <ATen/core/qualified_name.h> 4 #include <torch/csrc/Export.h> 5 6 namespace torch::jit { 7 8 /** 9 * class NameMangler 10 * 11 * Utility to mangle qualified names in order to make them unique. We use this 12 * in various places where we to de-duplicate qualified names. 13 */ 14 class TORCH_API NameMangler { 15 public: 16 // Given a qualified name, return a mangled version that is guaranteed to be 17 // unique with respect to previous/future calls of `mangled()` on this name 18 // mangler instance. 19 c10::QualifiedName mangle(const c10::QualifiedName& name); 20 21 private: 22 size_t mangleIndex_ = 0; 23 }; 24 25 } // namespace torch::jit 26