I'm using protoc to generate cpp files for tensorflow
serving https://github.com/tensorflow/serving.
But I get this strange error and I don't know how to resolve it.
<https://lh3.googleusercontent.com/-H9ACggSt3Po/WyfVr2qMdHI/AAAAAAAADmQ/gLLV_Hn3XdQPcL3S86YPpVMyPsrbzgN2wCLcBGAs/s1600/%25E5%25BE%25AE%25E4%25BF%25A1%25E6%2588%25AA%25E5%259B%25BE_20180618235403.png>
The header namespace for TensorShape is
namespace protobuf_tensor_5fshape_2eproto {
// Internal implementation detail -- do not use these members.
struct TableStruct {
static const ::google::protobuf::internal::ParseTableField entries[];
static const ::google::protobuf::internal::AuxillaryParseTableField aux[];
static const ::google::protobuf::internal::ParseTable schema[2];
static const ::google::protobuf::internal::FieldMetadata field_metadata[];
static const ::google::protobuf::internal::SerializationTable
serialization_table[];
static const ::google::protobuf::uint32 offsets[];
};
void AddDescriptors();
void InitDefaultsTensorShapeProto_DimImpl();
void InitDefaultsTensorShapeProto_Dim();
void InitDefaultsTensorShapeProtoImpl();
void InitDefaultsTensorShapeProto();
inline void InitDefaults() {
InitDefaultsTensorShapeProto_Dim();
InitDefaultsTensorShapeProto();
}
} // namespace protobuf_tensor_5fshape_2eproto
The namespace is not same as the required one
namespace protobuf_tensor_2eproto {
void InitDefaultsTensorProtoImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_tensorflow_2fcore_2fframework_2ftensor_5fshape_2eproto::InitDefaultsTensorShapeProto();
protobuf_tensorflow_2fcore_2fframework_2fresource_5fhandle_2eproto::InitDefaultsResourceHandleProto();
{
void* ptr = &::tensorflow::_TensorProto_default_instance_;
new (ptr) ::tensorflow::TensorProto();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
{
void* ptr = &::tensorflow::_VariantTensorDataProto_default_instance_;
new (ptr) ::tensorflow::VariantTensorDataProto();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::tensorflow::TensorProto::InitAsDefaultInstance();
::tensorflow::VariantTensorDataProto::InitAsDefaultInstance();
}
tensor.proto has a package named "tensorflow" and is under
directory tensorflow/core/framework.
and import tensor_shape
It seems that protoc generate namespace in .cpp according to the path file
of import in tensor.proto, but don't refer it in .h file.
option cc_enable_arenas = true;
option java_outer_classname = "TensorProtos";
option java_multiple_files = true;
option java_package = "org.tensorflow.framework";
import "tensorflow/core/framework/resource_handle.proto";
import "tensorflow/core/framework/tensor_shape.proto";
import "tensorflow/core/framework/types.proto";
// Protocol buffer representing a tensor.
message TensorProto {
DataType dtype = 1;
// Shape of the tensor. TODO(touts): sort out the 0-rank issues.
TensorShapeProto tensor_shape = 2;
Can anyone help me? Thank you.
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.