Files
pytorch/c10/core/SymIntTable.cpp
PyTorch MergeBot 44436947bc Revert "Reland PySymInt (#79617)"
This reverts commit 8ef6356f267c75276ea23b51163274cd5fffc0ce.

Reverted https://github.com/pytorch/pytorch/pull/79617 on behalf of https://github.com/zengk95 due to this is breaking periodic jobs (and maybe pull) on trunk
2022-06-16 19:40:27 +00:00

29 lines
695 B
C++

#include <c10/core/SymbolicIntNode.h>
namespace c10 {
uint64_t SymIntTable::addNode(std::shared_ptr<SymbolicIntNode> sin) {
std::lock_guard<std::mutex> lock(mutex_);
auto index = nodes_.size();
nodes_.push_back(sin);
return index;
}
std::shared_ptr<SymbolicIntNode> SymIntTable::getNode(size_t index) {
std::lock_guard<std::mutex> lock(mutex_);
TORCH_CHECK(index < nodes_.size());
return nodes_[index];
}
c10::SymInt SymbolicIntNode::toSymInt() {
// We will need to figure out a way
// to dedup nodes
auto sit_sp = this->shared_from_this();
return SymInt::toSymInt(sit_sp);
}
SymIntTable& getSymIntTable() {
static SymIntTable sit;
return sit;
}
} // namespace c10