protocol-buffers

How to build Google protocol buffers and Kotlin using Gradle?

南笙酒味 提交于 2020-12-29 05:29:19
问题 I'm trying to build a project that uses both Google protocol buffers and Kotlin using Gradle. I want the proto files to compile into Java source, which is then called from my Kotlin code. My source files are arranged like this: src/main/proto/*.proto src/main/kotlin/*.kt src/test/kotlin/*.kt Here's my build.gradle file: version '1.0-SNAPSHOT' apply plugin: 'kotlin' apply plugin: 'java' apply plugin: 'com.google.protobuf' repositories { mavenCentral() maven { url "http://dl.bintray.com/kotlin

Weights and Bias from Trained Meta Graph

不想你离开。 提交于 2020-12-29 04:41:59
问题 I have successfully exported a re-trained InceptionV3 NN as a TensorFlow meta graph. I have read this protobuf back into python successfully, but I am struggling to see a way to export each layers weight and bias values, which I am assuming is stored within the meta graph protobuf, for recreating the nn outside of TensorFlow. My workflow is as such: Retrain final layer for new categories Export meta graph tf.train.export_meta_graph(filename='model.meta') Build python pb2.py using Protoc and

'optional repeated' with google protobuf for Java

最后都变了- 提交于 2020-12-29 02:45:52
问题 I am using Google Protobuf using java. I wrote a statement like optional repeated string users = 9; When I tried to compile I am getting an error like message.proto:39:57: Missing field number. All I wanted was to create an array of strings. Can anybody help me to resolve it. PS: If I avoided optional keyword then it is compiling but in java I am getting a class not found error for com.google.protobuf.ProtocolStringList Thanks in advance 回答1: All you need is: repeated string users = 9; You

'optional repeated' with google protobuf for Java

陌路散爱 提交于 2020-12-29 02:45:13
问题 I am using Google Protobuf using java. I wrote a statement like optional repeated string users = 9; When I tried to compile I am getting an error like message.proto:39:57: Missing field number. All I wanted was to create an array of strings. Can anybody help me to resolve it. PS: If I avoided optional keyword then it is compiling but in java I am getting a class not found error for com.google.protobuf.ProtocolStringList Thanks in advance 回答1: All you need is: repeated string users = 9; You

golang protobuf remove omitempty tag from generated json tags

青春壹個敷衍的年華 提交于 2020-12-28 07:04:45
问题 I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files. if i have a proto message like this message Status { int32 code = 1; string message = 2; } The generated struct looks like this type Status struct { Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` } But My need is to remove the omitempty tag from the

golang protobuf remove omitempty tag from generated json tags

浪子不回头ぞ 提交于 2020-12-28 06:56:28
问题 I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files. if i have a proto message like this message Status { int32 code = 1; string message = 2; } The generated struct looks like this type Status struct { Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` } But My need is to remove the omitempty tag from the

golang protobuf remove omitempty tag from generated json tags

烂漫一生 提交于 2020-12-28 06:50:27
问题 I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files. if i have a proto message like this message Status { int32 code = 1; string message = 2; } The generated struct looks like this type Status struct { Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` } But My need is to remove the omitempty tag from the

golang protobuf remove omitempty tag from generated json tags

我怕爱的太早我们不能终老 提交于 2020-12-28 06:47:31
问题 I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files. if i have a proto message like this message Status { int32 code = 1; string message = 2; } The generated struct looks like this type Status struct { Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` } But My need is to remove the omitempty tag from the

Text encoding of Protocol Buffers string fields

自闭症网瘾萝莉.ら 提交于 2020-12-26 06:44:06
问题 If a C++ program receives a Protocol Buffers message that has a Protocol Buffers string field, which is represented by a std::string , what is the encoding of text in that field? Is it UTF-8? 回答1: Protobuf strings are always valid UTF-8 strings. See the Language Guide: A string must always contain UTF-8 encoded or 7-bit ASCII text. (And ASCII is always also valid UTF-8.) Not all protobuf implementations enforce this, but if I recall correctly, at least the Python library refuses to decode non

Text encoding of Protocol Buffers string fields

风格不统一 提交于 2020-12-26 06:43:11
问题 If a C++ program receives a Protocol Buffers message that has a Protocol Buffers string field, which is represented by a std::string , what is the encoding of text in that field? Is it UTF-8? 回答1: Protobuf strings are always valid UTF-8 strings. See the Language Guide: A string must always contain UTF-8 encoded or 7-bit ASCII text. (And ASCII is always also valid UTF-8.) Not all protobuf implementations enforce this, but if I recall correctly, at least the Python library refuses to decode non