mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
This PR relands the changes introduced in PR https://github.com/pytorch/pytorch/pull/100849. The old PR turnd nnc_* functions into static. We now add declarations for them and hope that inter builds will pass. Pull Request resolved: https://github.com/pytorch/pytorch/pull/102228 Approved by: https://github.com/albanD
29 lines
531 B
C++
29 lines
531 B
C++
#include <torch/csrc/jit/passes/annotate_warns.h>
|
|
|
|
#include <atomic>
|
|
|
|
namespace torch {
|
|
namespace jit {
|
|
|
|
static void AnnotateWarns(Block* b) {
|
|
static std::atomic<int64_t> idx(0);
|
|
for (Node* n : b->nodes()) {
|
|
for (Block* child_b : n->blocks()) {
|
|
AnnotateWarns(child_b);
|
|
}
|
|
|
|
if (n->kind() != aten::warn) {
|
|
continue;
|
|
}
|
|
|
|
n->i_(attr::warn_id, idx);
|
|
idx++;
|
|
}
|
|
}
|
|
|
|
void AnnotateWarns(const std::shared_ptr<Graph>& graph) {
|
|
AnnotateWarns(graph->block());
|
|
}
|
|
|
|
} // namespace jit
|
|
} // namespace torch
|