Files
pytorch/torch/csrc/jit/passes/annotate_warns.cpp
cyy c2f28d1c1d fix missing-prototypes warnings in torch_cpu (Part 4) (#100849)
This PR fixes more missing-prototypes violations in the torch_cpu source following PRs #100053, #100147 and #100245

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100849
Approved by: https://github.com/albanD
2023-05-18 03:49:45 +00:00

30 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