diff options
Diffstat (limited to 'tensorflow/core/common_runtime/eigen_thread_pool.h')
-rw-r--r-- | tensorflow/core/common_runtime/eigen_thread_pool.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/core/common_runtime/eigen_thread_pool.h b/tensorflow/core/common_runtime/eigen_thread_pool.h new file mode 100644 index 0000000000..2554f3521b --- /dev/null +++ b/tensorflow/core/common_runtime/eigen_thread_pool.h @@ -0,0 +1,22 @@ +#ifndef TENSORFLOW_COMMON_RUNTIME_EIGEN_THREAD_POOL_H_ +#define TENSORFLOW_COMMON_RUNTIME_EIGEN_THREAD_POOL_H_ + +#include "tensorflow/core/lib/core/threadpool.h" +#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" + +namespace tensorflow { + +class EigenThreadPoolWrapper : public Eigen::ThreadPoolInterface { + public: + explicit EigenThreadPoolWrapper(thread::ThreadPool* pool) : pool_(pool) {} + ~EigenThreadPoolWrapper() override {} + + void Schedule(std::function<void()> fn) override { pool_->Schedule(fn); } + + private: + thread::ThreadPool* pool_ = nullptr; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMMON_RUNTIME_EIGEN_THREAD_POOL_H_ |