1 #include <torch/csrc/jit/scope.h> 6 ScopePtr Scope::push(Symbol name) {
7 return c10::make_intrusive<Scope>(intrusive_from_this(), name);
10 ScopePtr Scope::getRoot() {
11 ScopePtr current = intrusive_from_this();
12 while (current->parent_) {
13 current = current->parent_;
18 size_t Scope::getDepth() {
20 ScopePtr current = intrusive_from_this();
21 while (current->parent_) {
22 current = current->parent_;
28 std::string Scope::namesFromRoot(
const std::string& separator)
const {
30 std::string out = this->name_.toUnqualString();
34 ScopePtr parent = this->parent_;
35 while (!parent->isRoot()) {
37 out = std::string(parent->name_.toUnqualString()) + separator + out;
38 parent = parent->parent_;