| 97 | }; |
| 98 | |
| 99 | class ShapeHandle { |
| 100 | public: |
| 101 | ShapeHandle() {} |
| 102 | bool SameHandle(ShapeHandle s) const { return ptr_ == s.ptr_; } |
| 103 | std::size_t Handle() const { return reinterpret_cast<std::size_t>(ptr_); } |
| 104 | |
| 105 | private: |
| 106 | ShapeHandle(const Shape* shape) { ptr_ = shape; } |
| 107 | const Shape* operator->() const { return ptr_; } |
| 108 | bool IsSet() const { return ptr_ != nullptr; } |
| 109 | |
| 110 | const Shape* ptr_ = nullptr; |
| 111 | |
| 112 | friend class InferenceContext; |
| 113 | friend class ShapeInferenceTest; |
| 114 | friend class ShapeInferenceTestutil; |
| 115 | friend class ::tensorflow::ShapeRefinerTest; |
| 116 | friend class ShapeManager; |
| 117 | friend class ::tensorflow::grappler::SymbolicShapeManager; |
| 118 | |
| 119 | // Intentionally copyable. |
| 120 | }; |
| 121 | |
| 122 | // Struct used to allow functions to take DimensionHandle or a dimension value. |
| 123 | // Not meant to be constructed directly. |
no outgoing calls