我感兴趣的是得到它定义为指针的输出张量的值:如何获得指针型张量的形状?
Tensor* out = nullptr;
我试图out->get_shape()
会抛出错误:
error: 'class tensorflow::Tensor' has no member named 'get_shape'; did you mean 'set_shape'?
如何获得形状?
我感兴趣的是得到它定义为指针的输出张量的值:如何获得指针型张量的形状?
Tensor* out = nullptr;
我试图out->get_shape()
会抛出错误:
error: 'class tensorflow::Tensor' has no member named 'get_shape'; did you mean 'set_shape'?
如何获得形状?
可以使用'shape()'温控功能访问张的形状,它会返回一个TensorShape
,打印的值,你可以使用.vec()
方法
const TensorShape& out_shape = out.shape();
std::cout << "out = " << out_shape.dim_sizes() << std::endl;
你可以试试,'OUT->形状()'; –
我试图打印使用:'std :: cout <<“out =”<< out-> shape()<< std :: endl;'。它说:'错误:'operator <<'不匹配(操作数类型是'std :: basic_ostream'和'const tensorflow :: TensorShape')' –
NamrataB