protocol-buffers

Google Protocol Buffers, how to handle multiple message-Types?

爷,独闯天下 提交于 2019-12-05 19:11:32
Is it possible to get the Type of the serialized Protocol Buffer message? I have this example option java_outer_classname="ProtoUser"; message User { required int32 id = 1; required string name = 2; required string firstname = 3; required string lastname = 4; required string ssn= 5; } message Address { required int32 id = 1; required string country = 2 [default = "US"];; optional string state = 3; optional string city = 4; optional string street = 5; optional string zip = 6; } In Java I have this code Address addr = ProtoUser.Address.newBuilder().setCity("Weston").setCountry("USA").setId(1)

VS Code PyLint Error E0602 (undefined variable) with ProtoBuf compiled Python Structure

北战南征 提交于 2019-12-05 19:11:28
I was using Visual Studio for a long time, but it was becoming too complicated to maintain. Now I tried to move to VS Code, but it throws a number of PyLint error messages that don't make sense to me (and the program still works as expected). These errors happen primarily with Python code generated from a GoogleProtoBuf structure. For example: from lbsnstructure.lbsnstructure_pb2 import lbsnPost def geoaccuracy_within_threshold(post_geoaccuracy, min_geoaccuracy): """Checks if geoaccuracy is within or below threshhold defined""" if min_geoaccuracy == lbsnPost.LATLNG: allowed_geoaccuracies =

Does anyone know of an Ada plugin for protocol buffers?

时光怂恿深爱的人放手 提交于 2019-12-05 18:58:52
I'm looking for an Ada plugin for protocol buffers. Looks like there is just about any language plugin available or in the works except for Ada. Well, the only thing I found is this thesis . Unfortunately, I did not find any source code for a translation tool, i.e. what you name a plugin . The only thing I can tell is that the tool was developed in C++. UPDATE There's finally an Ada implementation for Protocol Buffers. It has been developed by Per Sandberg and is available on GitHub . I didn't check if this is a full Ada implementation or if it relies on C/C++ version as a thin binding Please

protocol buffers: how to serialize and deserialize multiple messages into a file (c++)?

人走茶凉 提交于 2019-12-05 16:36:13
I am new to Protocol Buffers and c++ but my task requires me to use the two. I want to write a structure of data ( message) into a single file multiple times and be able to read the data. i can read and write a single message but multiple messages is proving harder. I have looked for answers for hours but i can't seem to be able to read the data as a structure. Any example code or pointers will be very helpful. This is the format of my structure: typedef struct Entry { char name[ NAME_MAX]; int id; int age; char DoB[32]; } entry; This is what i've been using to write into a file: Person_File

GRPC: Client streaming with configuration message

做~自己de王妃 提交于 2019-12-05 15:55:28
Here's a proto definition for a service that consumes a stream of events from a client message Event { // ... } service EventService { rpc Publisher(stream Event) returns (google.protobuf.Empty); } The problem is that the server needs to be told what to do with this stream. Ideally, it would first recieve an Options message: message Event { // ... } message Options { // ... } service EventService { rpc Publisher(Options, stream Event) returns (google.protobuf.Empty); } However, grpc only supports one parameter for rpc methods. One solution is to introduce an additional PublishMessage message

Making shared_ptr lose ownership of memory

放肆的年华 提交于 2019-12-05 15:33:49
I have a shared_ptr<MyProto> which I pass around. Eventually, in certain situations, I want pass the raw pointer to a function which then becomes the memory owner. In those cases the shared_ptr isn't responsible anymore for freeing the memory because the function I call took ownership. How do I get the shared_ptr to lose ownership? The reason I want to have the shared_ptr lose ownership is that I want to use protocol buffer's AddAllocated functionality which takes an already allocated pointer and assumes ownership of it. Example: shared_ptr<MyProto> myProtoSharedPtr = // by this point this is

TensorFlow freeze_graph.py: The name 'save/Const:0' refers to a Tensor which does not exist

淺唱寂寞╮ 提交于 2019-12-05 12:34:51
问题 I am currently trying to export a trained TensorFlow model as a ProtoBuf file to use it with the TensorFlow C++ API on Android. Therefore, I'm using the freeze_graph.py script. I exported my model using tf.train.write_graph : tf.train.write_graph(graph_def, FLAGS.save_path, out_name, as_text=True) and I'm using a checkpoint saved with tf.train.Saver . I invoke freeze_graph.py as described at the top of the script. After compiling, I run bazel-bin/tensorflow/python/tools/freeze_graph \ --input

How to use dart-protobuf

北城以北 提交于 2019-12-05 10:50:30
I'm considering using dart-protobuf instead of JSON in one of my projects. The problem is that the library does not provide any example of how to use it, and the tests don't really help either. I'm also a bit confused on how the parsing of .proto files would work. So I'm looking for a simple example of how to use this library in dart. I'm not too familiar with dart-protobuf, but it looks like you have to use the protobuf compiler and the dart-protoc-plugin project to generate your Dart protobuf library from a proto definition. There are some instructions here: https://github.com/dart-lang/dart

How to show hidden layer outputs in Tensorflow

一世执手 提交于 2019-12-05 09:39:54
I'm having differences of the outputs when comparing a model with its stored protobuf version (via this conversion script ). For debugging I'm comparing both layers respectively. For the weights and the actual layer output during a test sequence I receive the identical outputs, thus I'm not sure how to access the hidden layers. Here is how I load the layers input = graph.get_tensor_by_name("lstm_1_input_1:0") layer1 = graph.get_tensor_by_name("lstm_1_1/kernel:0") layer2 = graph.get_tensor_by_name("lstm_1_1/recurrent_kernel:0") layer3 = graph.get_tensor_by_name("time_distributed_1_1/kernel:0")

How to get structure of a Google Protobuf message without the definition

ε祈祈猫儿з 提交于 2019-12-05 09:17:16
I have to get the message structure of a protobuf message transfered to me without the message's definition. Using UnknownFieldSet methods, I was able to get a string representation of the message as below: 1: "a" 2: { 3:"b" 4:"c" } What data structure does field 2 represent ? Using UnknownFieldSet.Field.getGroupList i was able to get the content of field 3 and 4, does that means field 2 has the "deprecated" group structure ? If you posted the raw binary data we could tell you - or you could look at the protocol buffer encoding documentation . If you see a field with a wire type of 3, that