NestedNode Class — pytorch Architecture
Architecture documentation for the NestedNode class in NestedTensorUtils.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/nested/NestedTensorUtils.h lines 234–271
template <typename T>
struct NestedNode {
NestedNode() = delete;
explicit NestedNode(std::vector<T> children)
: _is_leaf(false), _children(std::move(children)) {}
explicit NestedNode(TensorList children)
: _is_leaf(false), _children(children.vec()) {}
explicit NestedNode(T payload)
: _is_leaf(true), _payload(std::move(payload)) {}
NestedNode(const NestedNode&) = delete;
NestedNode& operator=(const NestedNode&) = delete;
NestedNode(NestedNode&&) noexcept = default;
NestedNode& operator=(NestedNode&&) noexcept = default;
~NestedNode() = default;
inline bool is_leaf() const {
return _is_leaf;
}
inline size_t degree() const {
return _children.size();
}
inline const std::vector<T> unbind() const {
return _children;
}
inline T children(size_t i) const {
return _children[i];
}
inline const T& payload() const {
return _payload;
}
inline T& payload() {
return _payload;
}
private:
bool _is_leaf;
std::vector<T> _children;
T _payload{};
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free