Remove duplicate private section of thread_pool()

This commit is contained in:
Hanyu Deng
2025-04-23 11:00:57 +08:00
committed by Awni Hannun
parent 27ceff33d3
commit f034b51e38
3 changed files with 5 additions and 7 deletions

View File

@@ -99,11 +99,9 @@ class ParallelFileReader : public Reader {
return "file " + label_; return "file " + label_;
} }
private:
static ThreadPool& thread_pool();
private: private:
static constexpr size_t batch_size_ = 1 << 25; static constexpr size_t batch_size_ = 1 << 25;
static ThreadPool& thread_pool();
int fd_; int fd_;
std::string label_; std::string label_;
}; };

View File

@@ -42,8 +42,8 @@ class Synchronizer : public Primitive {
// are currently under a function transformation and the retain_graph() // are currently under a function transformation and the retain_graph()
// function which returns true if we are forced to retain the graph during // function which returns true if we are forced to retain the graph during
// evaluation. // evaluation.
std::vector<char>& detail::InTracing::trace_stack() { std::vector<std::pair<char, char>>& detail::InTracing::trace_stack() {
static std::vector<char> trace_stack_; static std::vector<std::pair<char, char>> trace_stack_;
return trace_stack_; return trace_stack_;
} }
int detail::InTracing::grad_counter{0}; int detail::InTracing::grad_counter{0};

View File

@@ -26,7 +26,7 @@ struct InTracing {
} }
~InTracing() { ~InTracing() {
grad_counter -= trace_stack().back().second; grad_counter -= trace_stack().back().second;
trace_stack.pop_back(); trace_stack().pop_back();
} }
static bool in_tracing() { static bool in_tracing() {
@@ -43,7 +43,7 @@ struct InTracing {
private: private:
static int grad_counter; static int grad_counter;
static std::vector<char>& trace_stack(); static std::vector<std::pair<char, char>>& trace_stack();
}; };
struct RetainGraph { struct RetainGraph {