diff options
author | error.d <error.d@gmail.com> | 2017-12-27 03:21:44 +0800 |
---|---|---|
committer | drpngx <drpngx@users.noreply.github.com> | 2017-12-26 11:21:44 -0800 |
commit | 77e15b409b76bb68b7a182c68a875443b4f82a9d (patch) | |
tree | e8c374967bfd16b389e8dc25043c6001b5bce0c5 | |
parent | fe2b9a2bc69b3599415c7fb258d4b5b9c33e8965 (diff) |
call within the loop (#15446)
* call within the loop
optimize call within the loop
* const int
-rw-r--r-- | tensorflow/core/common_runtime/direct_session.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/core/common_runtime/direct_session.cc b/tensorflow/core/common_runtime/direct_session.cc index 6e243c4b7c..a10c176127 100644 --- a/tensorflow/core/common_runtime/direct_session.cc +++ b/tensorflow/core/common_runtime/direct_session.cc @@ -259,9 +259,10 @@ DirectSession::DirectSession(const SessionOptions& options, factory_(factory), cancellation_manager_(new CancellationManager()), operation_timeout_in_ms_(options_.config.operation_timeout_in_ms()) { - if (options_.config.session_inter_op_thread_pool_size() > 0) { - for (int i = 0; i < options_.config.session_inter_op_thread_pool_size(); - ++i) { + const int thread_pool_size = + options_.config.session_inter_op_thread_pool_size(); + if (thread_pool_size > 0) { + for (int i = 0; i < thread_pool_size; ++i) { thread::ThreadPool* pool = nullptr; bool owned = false; init_error_.Update(NewThreadPoolFromThreadPoolOptions( |