#include #include namespace torch::jit { static void AnnotateWarns(Block* b) { static std::atomic 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) { AnnotateWarns(graph->block()); } } // namespace torch::jit