提交 eab0e522 编写于 作者: Y Yu Yang

To google code style

上级 32fe0976
......@@ -61,7 +61,7 @@ Just like [scope](https://en.wikipedia.org/wiki/Scope_(computer_science)) in pro
```cpp
class Scope {
public:
public:
Scope(const std::shared_ptr<Scope>& scope): parent_(scope) {}
Variable* GetVar(const std::string& name) const {
......@@ -75,7 +75,7 @@ public:
}
}
private:
private:
std::shared_ptr<Scope> parent_ {nullptr};
};
```
......@@ -88,16 +88,16 @@ A local scope is very useful when we implement Recurrent Neural Network. Each ti
```cpp
class Variable {
private:
private:
Variable() = default;
friend class Scope;
};
class Scope {
private:
private:
Scope(const std::shared_ptr<Scope>& parent = nullptr);
public:
public:
static std::shared_ptr<Scope> Create(const std::shared_ptr<Scope>& parent = nullptr);
// return nullptr if not found.
......@@ -106,7 +106,7 @@ public:
// return Error if already contains same name variable.
Error CreateVariable(const std::string& name);
private:
private:
std::shared_ptr<Scope> parent_;
std::unordered_map<std::string, std::unique_ptr<Scope>> attrs_;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册