【发布时间】:2019-10-24 04:20:14
【问题描述】:
我想打印buf_中的Buffer成员变量,也就是说,
我想p *(tensorflow::Buffer*)buf_ 打印 Buffer 类中的成员变量。
张量流中的代码,1.10.1。
类关系:类TensorBuffer是tensor.h中的基类,Buffer是tensor.cc中的模板和派生类
以下是lldb的输出:
frame #0: 0x0000000175abffc0
libtensorflow_framework.so`tensorflow::Tensor::Tensor(this=0x000070000cadd308, a=0x00007fd91ea61500, type=DT_STRING, shape=0x000070000cadd2f0) at tensor.cc:726:3
723 CHECK_NOTNULL(a);
724 if (shape_.num_elements() > 0 || a->ShouldAllocateEmptyTensors()) {
725 CASES(type, buf_ = new Buffer<T>(a, shape.num_elements()));
-> 726 }
(lldb) p buf_
(tensorflow::TensorBuffer *) $17 = 0x00007fd91e927c40
(lldb) p *(Buffer<std::__1::string>*)buf_
error: use of undeclared identifier 'Buffer'
error: expected '(' for function-style cast or type construction
error: expected expression
(lldb) p *(tensorflow::Buffer<std::__1::string>*)buf_
error: no member named 'Buffer' in namespace 'tensorflow'
error: expected '(' for function-style cast or type construction
error: expected expression
第 725 行解码:
switch(type)
case DataTypeToEnum<string>::value :
{
typedef string T;
buf_ = new Buffer<T>(a, shape.num_elements(), allocation_attr);
}
【问题讨论】:
-
我重新安装 lldb 9.0.0,但有同样的问题。
标签: c++ tensorflow lldb