TensorFlow源码框架 杂记

一.为何咱们须要使用线程池技术(ThreadPool)python

  线程:采用“即时建立,即时销毁”策略,即接受请求后,建立一个新的线程,执行任务,完毕后,线程退出;git

  线程池:应用软件启动后,当即建立必定数量的线程,放入空闲队列;github

  优缺点分析:使用线程处理多请求,低任务量问题时,不断建立、销毁线程,开销巨大;使用线程池可以减小建立销毁的开销;session

 

二.C++11中使用unordered_map代替hash_map,另外增长了unique_ptr智能指针;(override GUARDED_BY等)app

 

三.SWIG是一个很是优秀的开源工具,支持将C/C++代码与任何主流脚本语言相集成(包括Ruby,Perl、Tcl和Python)框架

 

四.阅读tensorflow源码ide

  1. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/common_runtime/direct_session.cc工具

  
  代码注释写的十分详细,主要阅读部分.h文件。
 
  代码框架:
  
    core/ contains the main C++ code and runtimes.

  core/ops/ contains the "signatures" of the operations
  core/kernels/ contains the "implementations" of the operations (including CPU and CUDA kernels)
  core/framework/ contains the main abstract graph computation and other useful libraries
  core/platform/ contains code that abstracts away the platform and other imported libraries (protobuf, etc)

  TensorFlow relies heavily on the Eigen library for both CPU and GPU calculations.  Though some GPU kernels are implemented directly with CUDA code.

  bazel builds certain C++ code using gcc/clang, and certain CUDA code (files with extension . cu.cc) with nvcc.

  python/ops/ contain the core python interface
  python/kernel_tests/ contain the unit tests and lots of example code
  python/framework/ contains the python abstractions of graph, etc, a lot of which get serialized down to proto and/or get passed to swigged session calls.
  python/platform/ is similar to the C++ platform, adding lightweight wrappers for python I/O, unit testing, etc.

  contrib/*/ directories generally mimic the root tensorflow path (i.e., they have core/ops/, etc) 
 
五. 有意思的DeepLearning项目网址: http://deeplearninggallery.com/
 
参考文献:
相关文章
相关标签/搜索