protocol-buffers

How can I create TensorProto for TensorFlow in Java?

允我心安 提交于 2020-01-04 10:59:13
问题 Now we're using tensorflow/serving for inference. It exposes gRPC service and we can generate the Java classes from the proto file. Now we can generate the PreditionService from https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/prediction_service.proto but how can I construct the TensorProto objects from multiple dimention array. We have some examples from Python ndarray and C++. It would be great if someone has tried in Java. There's some work about running TensorFlow

Where is the (meta) .proto file which describes .desc files?

自闭症网瘾萝莉.ら 提交于 2020-01-04 09:14:50
问题 Where is the (meta) .proto file which describes .desc files? I make .desc files with: protoc --descriptor_set_out=foo.desc --include_imports foo.proto Am I correct in believing that the .desc files are in protobuf format? If so, where can I get the .proto file which describes their format? 回答1: The format is FileDescriptorSet as defined in descriptor.proto : https://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/descriptor.proto descriptor.proto is typically installed to

protobuf-net : how to annotate properties of derived type?

一笑奈何 提交于 2020-01-04 05:44:13
问题 For the latest version of protobuf-net ( r640 folder ), how to best annotate a ProtoMember that is a derived type ? [ProtoBuf.ProtoContract(Name=@"MyBaseTypeProto")] [Serializable] public partial class MyBaseType: ProtoBuf.IExtensible { ... } [ProtoBuf.ProtoContract(Name=@"MyDerivedTypeProto")] [Serializable] public partial class MyDerivedType : MyBaseType, ProtoBuf.IExtensible { ... } [ProtoBuf.ProtoContract(Name=@"MyMessageProto")] [Serializable] public partial class MyMessage : ProtoBuf

Protobuf - Refuses to link vs2013 or vs2015

≯℡__Kan透↙ 提交于 2020-01-04 05:17:13
问题 As the title states I cannot get protobuf to link successfully. Here is the small test program. note the AddressBook class was generated usin gthe protoc compiler that was built when i compiled protobuf.Additionally, this proto file is part of googles protobuf examples that is included with the source. #define PROTOBUF_USE_DLLS #include <iostream> #include "addressbook.pb.h" #pragma comment(lib, "libprotocd.lib") #pragma comment(lib, "libprotobufd.lib") #pragma comment(lib, "libprotobuf-lited

Parsing Protocol Buffers, written in Java and read in Python

断了今生、忘了曾经 提交于 2020-01-04 05:12:09
问题 I am dealing with a situation where the protocol buffers have been written to in Java, but I have to read them using Python. I have the .proto file with me, I have compiled it using protoc, and generated the python class file. The proto file has multiple messages, for example: message ABC { optional int64 id = 1 [default = -1]; optional int64 hello6 = 2; optional bool hello5 = 3 [default = true]; optional int32 hello4 = 4; optional int64 hello3 = 5; optional int64 hello2 = 6; optional int64

Comparison of streaming message implementations in protobuf

寵の児 提交于 2020-01-04 04:00:06
问题 What are the trade-offs, advantages and disadvantages of each of these streaming implementations where multiple messages of the same type are encoded? Are they any different at all ? What I want achieve is to store a vector of box'es, into a protobuf. Impl 1 : package foo; message Boxes { message Box { required int32 w = 1; required int32 h = 2; } repeated Box boxes = 1; } Impl 2: package foo; message Box { required int32 w = 1; required int32 h = 2; } message Boxes { repeated Box boxes = 1;

C# Google.ProtocolBuffers Deserialization Method (proto3)

眉间皱痕 提交于 2020-01-03 15:34:11
问题 I have recently upgraded my code base (Java, C++ and C#) to use proto3. In the case of C# this has involved over 2000 changes to the code. This is mostly semantic and all good, but there is one issue I can't seem to fathom; serialization/deserialization. I have the following amended method to desearialize my IMessage types (the code to do this in proto2 is commented), this is the code that is show in the examples within the GitHub repository... public static T ToObject<T>(this byte[] buf)

Is it possible to define an alias for type (enum or message) in google protobuf?

筅森魡賤 提交于 2020-01-03 15:27:44
问题 I have two enums in my proto file which define almost the same values. Is it possible to cut out one of them and to leave an alias to keep all the code working? Example: enum A { a = 0; b = 1; } enum B { a = 0; b = 1; } I want to have something like typedef in c++: enum A { a = 0; b = 1; } typedef A B; I haven't found this in documentation. Are there any workarounds ? 回答1: This is an old question, but if some people are still interested, It is possible to create alias on enum with protobuf

Is it possible to define an alias for type (enum or message) in google protobuf?

南笙酒味 提交于 2020-01-03 15:27:04
问题 I have two enums in my proto file which define almost the same values. Is it possible to cut out one of them and to leave an alias to keep all the code working? Example: enum A { a = 0; b = 1; } enum B { a = 0; b = 1; } I want to have something like typedef in c++: enum A { a = 0; b = 1; } typedef A B; I haven't found this in documentation. Are there any workarounds ? 回答1: This is an old question, but if some people are still interested, It is possible to create alias on enum with protobuf

Undefined variable from import when using protocol buffers in PyDev

穿精又带淫゛_ 提交于 2020-01-03 10:21:43
问题 I've got a PyDev project that uses protocol buffers. The protocol buffer files are located in a zip file generated by the protoc compiler. Everything works when I run the program, however PyDev reports "Undefined variable from import" for every enumeration constant. So for example: import model_pb2 value = model_pb2.Expression(type = model_pb2.Expression.PARAMETER) It reports the enum constant "PARAMETER" as being an undefined variable. There are several dozen similar errors in my program,