TensorFlow 源代码的调用堆栈跟踪?
The call-stacktrace of TensorFlow source code?
我想长期研究TensorFlow,所以我想阅读它的源代码,但在开始时。例如:
找不到更深层次的功能
函数Shape
在哪里计算?
您显示的代码片段是自动生成的代码片段,它向图形添加了 "Shape"
操作 。 _op_def_lib.apply_op()
参数中的字符串 "Shape"
确定节点的操作类型。标准操作类型在 C++ 源代码中注册,在 tensorflow/core/ops/
directory of the TensorFlow source code. In particular, the "Shape"
operation is registered in tensorflow/core/ops/array_ops.cc
中。这些注册用于定义每个操作的输入、属性和输出的类型,Python 包装器是从这些注册生成的。
第一次 运行 包含该节点的子图(即在调用 tf.Session.run()
时),TensorFlow 将查找相应的 内核 在特定设备上实现操作。 (例如,CPU 和运算的 GPU 实现通常有单独的内核。)标准内核实现在 C++ 源代码中注册,在 TensorFlow 源代码的 tensorflow/core/kernels/
目录中。特别是,"Shape"
内核在 tensorflow/core/kernels/shape_ops.cc
. The kernel registration names a class the implements the kernel, which must be a subclass of tensorflow::OpKernel
, and in this case is the tensorflow::ShapeOp
class 中注册。子图运行s第一次调用构造函数,每次运行运行s.
时调用Compute()
方法
我想长期研究TensorFlow,所以我想阅读它的源代码,但在开始时。例如:
找不到更深层次的功能
函数Shape
在哪里计算?
您显示的代码片段是自动生成的代码片段,它向图形添加了 "Shape"
操作 。 _op_def_lib.apply_op()
参数中的字符串 "Shape"
确定节点的操作类型。标准操作类型在 C++ 源代码中注册,在 tensorflow/core/ops/
directory of the TensorFlow source code. In particular, the "Shape"
operation is registered in tensorflow/core/ops/array_ops.cc
中。这些注册用于定义每个操作的输入、属性和输出的类型,Python 包装器是从这些注册生成的。
第一次 运行 包含该节点的子图(即在调用 tf.Session.run()
时),TensorFlow 将查找相应的 内核 在特定设备上实现操作。 (例如,CPU 和运算的 GPU 实现通常有单独的内核。)标准内核实现在 C++ 源代码中注册,在 TensorFlow 源代码的 tensorflow/core/kernels/
目录中。特别是,"Shape"
内核在 tensorflow/core/kernels/shape_ops.cc
. The kernel registration names a class the implements the kernel, which must be a subclass of tensorflow::OpKernel
, and in this case is the tensorflow::ShapeOp
class 中注册。子图运行s第一次调用构造函数,每次运行运行s.
Compute()
方法