mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
rebased https://github.com/pytorch/pytorch/pull/79617/ to see if issues are reproducible. Pull Request resolved: https://github.com/pytorch/pytorch/pull/79795 Approved by: https://github.com/malfet
30 lines
696 B
C++
30 lines
696 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
|