/usr/local/lib64/python3.6/site-packages/torch/include/ATen/core
NameSizeModeActions
boxing/-0755rm
dispatch/-0755rm
op_registration/-0755rm
alias_info.h29860644editdlrm
Array.h7680644editdlrm
ATenGeneral.h450644editdlrm
ATenOpList.h2460644editdlrm
aten_interned_strings.h253890644editdlrm
Backtrace.h590644editdlrm
blob.h54220644editdlrm
builtin_function.h36490644editdlrm
DeprecatedTypeProperties.h37730644editdlrm
DeprecatedTypePropertiesRegistry.h7950644editdlrm
Dict.h131950644editdlrm
Dict_inl.h79960644editdlrm
Dimname.h11880644editdlrm
DimVector.h2470644editdlrm
DistributionsHelper.h125940644editdlrm
Formatting.h9590644editdlrm
function.h21450644editdlrm
functional.h14600644editdlrm
function_schema.h135770644editdlrm
function_schema_inl.h93190644editdlrm
Generator.h49350644editdlrm
grad_mode.h2100644editdlrm
interned_strings.h253320644editdlrm
interned_strings_class.h7700644editdlrm
ivalue.h388230644editdlrm
ivalue_inl.h599630644editdlrm
ivalue_to.h7560644editdlrm
jit_type.h759710644editdlrm
jit_type_base.h65080644editdlrm
LegacyTypeDispatch.h46260644editdlrm
List.h156670644editdlrm
List_inl.h110120644editdlrm
Macros.h440644editdlrm
MT19937RNGEngine.h64100644editdlrm
NamedTensor.h50500644editdlrm
operator_name.h30180644editdlrm
PhiloxRNGEngine.h64960644editdlrm
PythonModeTLS.h4030644editdlrm
qualified_name.h43580644editdlrm
QuantizerBase.h24430644editdlrm
Range.h4180644editdlrm
Reduction.h4610644editdlrm
rref_interface.h11440644editdlrm
Scalar.h290644editdlrm
ScalarType.h330644editdlrm
stack.h60340644editdlrm
Tensor.h17560644editdlrm
TensorAccessor.h102960644editdlrm
TensorBase.h327670644editdlrm
TensorBody.h2475550644editdlrm
TransformationHelper.h69110644editdlrm
typeid.h290644editdlrm
UndefinedTensorImpl.h420644editdlrm
UnsafeFromTH.h7080644editdlrm
VariableHooksInterface.h33120644editdlrm
Variadic.h22570644editdlrm
Vitals.h23050644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/include/ATen/core/qualified_name.h (4358B)
#pragma once #include #include #include #include namespace c10 { // Represents a name of the form "foo.bar.baz" struct QualifiedName { QualifiedName() {} // `name` can be a dotted string, like "foo.bar.baz", or just a bare name. /* implicit */ QualifiedName(const std::string& name) { TORCH_CHECK(!name.empty()); // split the string into its atoms. size_t startSearchFrom = 0; size_t pos = name.find(delimiter_, startSearchFrom); while (pos != std::string::npos) { auto atom = name.substr(startSearchFrom, pos - startSearchFrom); TORCH_INTERNAL_ASSERT( atom.size() > 0, "Invalid name for qualified name: '", name, "'"); atoms_.push_back(std::move(atom)); startSearchFrom = pos + 1; pos = name.find(delimiter_, startSearchFrom); } auto finalAtom = name.substr(startSearchFrom, pos - startSearchFrom); TORCH_INTERNAL_ASSERT( finalAtom.size() > 0, "Invalid name for qualified name: '", name, "'"); atoms_.emplace_back(std::move(finalAtom)); cacheAccessors(); } explicit QualifiedName(std::vector atoms) { for (const auto& atom : atoms) { TORCH_CHECK(!atom.empty(), "Atom cannot be empty"); TORCH_CHECK( atom.find(delimiter_) == std::string::npos, "Delimiter not allowed in atom"); } atoms_ = std::move(atoms); cacheAccessors(); } // Unnecessary copy. Ideally we'd use something like std::string_view. /* implicit */ QualifiedName(const char* name) : QualifiedName(std::string(name)) {} // `name` must be a bare name (no dots!) explicit QualifiedName(const QualifiedName& prefix, std::string name) { TORCH_INTERNAL_ASSERT(!name.empty()); TORCH_INTERNAL_ASSERT(name.find(delimiter_) == std::string::npos); atoms_.insert(atoms_.begin(), prefix.atoms_.begin(), prefix.atoms_.end()); atoms_.push_back(std::move(name)); cacheAccessors(); } // Is `this` a prefix of `other`? // For example, "foo.bar" is a prefix of "foo.bar.baz" bool isPrefixOf(const QualifiedName& other) const { const auto& thisAtoms = atoms_; const auto& otherAtoms = other.atoms_; if (thisAtoms.size() > otherAtoms.size()) { // Can't be a prefix if it's bigger return false; } for (size_t i = 0; i < thisAtoms.size(); i++) { if (thisAtoms[i] != otherAtoms[i]) { return false; } } return true; } // The fully qualified name, like "foo.bar.baz" const std::string& qualifiedName() const { return qualifiedName_; } // The leading qualifier, like "foo.bar" const std::string& prefix() const { return prefix_; } // The base name, like "baz" const std::string& name() const { return name_; } const std::vector& atoms() const { return atoms_; } bool operator==(const QualifiedName& other) const { return this->qualifiedName_ == other.qualifiedName_; } bool operator!=(const QualifiedName& other) const { return !(*this == other); } private: static constexpr char delimiter_ = '.'; // Helper for cacheAccessors() below. template std::string join(char delimiter, const T& v) { std::string out; size_t reserve = 0; for (const auto& e : v) { reserve += e.size() + 1; } out.reserve(reserve); for (size_t i = 0; i < v.size(); ++i) { if (i != 0) { out.push_back(delimiter); } out.append(v[i]); } return out; } void cacheAccessors() { qualifiedName_ = join(delimiter_, atoms_); if (atoms_.size() > 1) { ArrayRef view(atoms_); const auto prefixView = view.slice(0, view.size() - 1); prefix_ = join(delimiter_, prefixView); } if (atoms_.size() >= 1) { name_ = atoms_.back(); } } // The actual list of names, like "{foo, bar, baz}" std::vector atoms_; /* * Cached accessors, derived from `atoms_`. */ std::string qualifiedName_; std::string prefix_; std::string name_; }; } // namespace c10 namespace std { template <> struct hash { size_t operator()(const c10::QualifiedName& n) const noexcept { return std::hash()(n.qualifiedName()); } }; } // namespace std