Re: [protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-21 Thread Brian Palmer
Just peeking at
https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto (which
I'm guessing is the proto in question), I don't think it allows extension
at the moment.

On Wed, Jun 21, 2017 at 5:39 PM Bo Yang  wrote:

> For option 2, I think you can extend caffe.LayerParameter by your self,
> given that LayerParameter allows extension.
>
> On Wed, Jun 21, 2017 at 1:12 AM Brian Palmer  wrote:
>
>> Hi,
>>
>> it sounds to me like you should explore defining a new message that
>> contains the LayerParameter as a field. For example,
>>
>> syntax = "proto2";
>>
>> package lynxcommando;
>>
>> message AugmentedLayerParameter {
>>   optional caffe.LayerParameter base = 1;
>>   optional MyNewParameter my_new_parameter = 2;
>> }
>>
>> message MyNewParameter {
>>
>> };
>>
>> Alternatively, you could ask the caffe authors to add in an extension
>> range to their messages, so that you can do
>>
>> extend caffe.LayerParameter {
>>   optional MyNewParameter my_new_parameter = 12345;
>> }
>> in your my_new_parameter.proto.  See
>> https://developers.google.com/protocol-buffers/docs/proto#extensions
>>
>> As a last resort, there is support for creating "dynamic messages," but
>> most of the examples I found searching around were doing it in java or c++.
>> https://stackoverflow.com/questions/18836727/protocol-buffer-objects-generated-at-runtime
>>
>>
>>
>> On Thu, Jun 15, 2017 at 11:30 PM, Lynx Commando 
>> wrote:
>>
>>>
>>> First, is caffe managed by yourself?
>>> >No
>>> Otherwise, I don't suggest change it by your own (may cause
>>> incompatibility issues).
>>> >Unfortunately I have to
>>> Second, this seems like a python question instead of protobuf.
>>> >What I want to know is that if protobuf has a python api making it
>>> easier.
>>> >>More specifically , I am looking for something equivalent to a
>>> boost::xml_parser that parses xml
>>> >> In another word, I want to know if there is somepkg allows me to do
>>> the following thing
>>> >>> proto = somepkg.somecls.parse("src/caffe/caffe.proto")
>>> >>>
>>> proto['LayerParameter'].append(somepkg.somecls.optional_field("MyNewParam","my_new_param",param_id))
>>> >>> for fields in my_field_list:
>>> >>>  proto['MyNewParam'].append(field)
>>> >>> somepkg.somecls.write(proto,"src/caffe/caffe.proto")
>>>
>>>
>>>
>>>
>>> On Friday, June 16, 2017 at 2:21:17 AM UTC+8, Bo Yang wrote:

 First, is caffe managed by yourself? Otherwise, I don't suggest change
 it by your own (may cause incompatibility issues).
 Second, this seems like a python question instead of protobuf.

 On Wed, Jun 14, 2017 at 8:54 PM Lynx Commando 
 wrote:

> More specifically, I am using caffe and I'd like to add new layers to
> it.
> Then I need to modify the caffe.proto file by adding(or removing) some
> messages and corresponding fields to some other messages.
> I'd want to  know if I can do this automatically with a python script.
>
> --
> 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+u...@googlegroups.com.
> To post to this group, send email to prot...@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>
 --
>>> 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.
>>>
>>
>> --
>> 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.
>>
>

-- 
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.


Re: [protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-21 Thread 'Bo Yang' via Protocol Buffers
For option 2, I think you can extend caffe.LayerParameter by your self,
given that LayerParameter allows extension.

On Wed, Jun 21, 2017 at 1:12 AM Brian Palmer  wrote:

> Hi,
>
> it sounds to me like you should explore defining a new message that
> contains the LayerParameter as a field. For example,
>
> syntax = "proto2";
>
> package lynxcommando;
>
> message AugmentedLayerParameter {
>   optional caffe.LayerParameter base = 1;
>   optional MyNewParameter my_new_parameter = 2;
> }
>
> message MyNewParameter {
>
> };
>
> Alternatively, you could ask the caffe authors to add in an extension
> range to their messages, so that you can do
>
> extend caffe.LayerParameter {
>   optional MyNewParameter my_new_parameter = 12345;
> }
> in your my_new_parameter.proto.  See
> https://developers.google.com/protocol-buffers/docs/proto#extensions
>
> As a last resort, there is support for creating "dynamic messages," but
> most of the examples I found searching around were doing it in java or c++.
> https://stackoverflow.com/questions/18836727/protocol-buffer-objects-generated-at-runtime
>
>
>
> On Thu, Jun 15, 2017 at 11:30 PM, Lynx Commando 
> wrote:
>
>>
>> First, is caffe managed by yourself?
>> >No
>> Otherwise, I don't suggest change it by your own (may cause
>> incompatibility issues).
>> >Unfortunately I have to
>> Second, this seems like a python question instead of protobuf.
>> >What I want to know is that if protobuf has a python api making it
>> easier.
>> >>More specifically , I am looking for something equivalent to a
>> boost::xml_parser that parses xml
>> >> In another word, I want to know if there is somepkg allows me to do
>> the following thing
>> >>> proto = somepkg.somecls.parse("src/caffe/caffe.proto")
>> >>>
>> proto['LayerParameter'].append(somepkg.somecls.optional_field("MyNewParam","my_new_param",param_id))
>> >>> for fields in my_field_list:
>> >>>  proto['MyNewParam'].append(field)
>> >>> somepkg.somecls.write(proto,"src/caffe/caffe.proto")
>>
>>
>>
>>
>> On Friday, June 16, 2017 at 2:21:17 AM UTC+8, Bo Yang wrote:
>>>
>>> First, is caffe managed by yourself? Otherwise, I don't suggest change
>>> it by your own (may cause incompatibility issues).
>>> Second, this seems like a python question instead of protobuf.
>>>
>>> On Wed, Jun 14, 2017 at 8:54 PM Lynx Commando 
>>> wrote:
>>>
 More specifically, I am using caffe and I'd like to add new layers to
 it.
 Then I need to modify the caffe.proto file by adding(or removing) some
 messages and corresponding fields to some other messages.
 I'd want to  know if I can do this automatically with a python script.

 --
 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+u...@googlegroups.com.
 To post to this group, send email to prot...@googlegroups.com.
 Visit this group at https://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> 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.
>>
>
> --
> 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.
>

-- 
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.


Re: [protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-21 Thread Brian Palmer
Hi,

it sounds to me like you should explore defining a new message that
contains the LayerParameter as a field. For example,

syntax = "proto2";

package lynxcommando;

message AugmentedLayerParameter {
  optional caffe.LayerParameter base = 1;
  optional MyNewParameter my_new_parameter = 2;
}

message MyNewParameter {

};

Alternatively, you could ask the caffe authors to add in an extension range
to their messages, so that you can do

extend caffe.LayerParameter {
  optional MyNewParameter my_new_parameter = 12345;
}
in your my_new_parameter.proto.  See
https://developers.google.com/protocol-buffers/docs/proto#extensions

As a last resort, there is support for creating "dynamic messages," but
most of the examples I found searching around were doing it in java or c++.
https://stackoverflow.com/questions/18836727/protocol-buffer-objects-generated-at-runtime



On Thu, Jun 15, 2017 at 11:30 PM, Lynx Commando 
wrote:

>
> First, is caffe managed by yourself?
> >No
> Otherwise, I don't suggest change it by your own (may cause
> incompatibility issues).
> >Unfortunately I have to
> Second, this seems like a python question instead of protobuf.
> >What I want to know is that if protobuf has a python api making it easier.
> >>More specifically , I am looking for something equivalent to a
> boost::xml_parser that parses xml
> >> In another word, I want to know if there is somepkg allows me to do the
> following thing
> >>> proto = somepkg.somecls.parse("src/caffe/caffe.proto")
> >>> proto['LayerParameter'].append(somepkg.somecls.
> optional_field("MyNewParam","my_new_param",param_id))
> >>> for fields in my_field_list:
> >>>  proto['MyNewParam'].append(field)
> >>> somepkg.somecls.write(proto,"src/caffe/caffe.proto")
>
>
>
>
> On Friday, June 16, 2017 at 2:21:17 AM UTC+8, Bo Yang wrote:
>>
>> First, is caffe managed by yourself? Otherwise, I don't suggest change it
>> by your own (may cause incompatibility issues).
>> Second, this seems like a python question instead of protobuf.
>>
>> On Wed, Jun 14, 2017 at 8:54 PM Lynx Commando 
>> wrote:
>>
>>> More specifically, I am using caffe and I'd like to add new layers to it.
>>> Then I need to modify the caffe.proto file by adding(or removing) some
>>> messages and corresponding fields to some other messages.
>>> I'd want to  know if I can do this automatically with a python script.
>>>
>>> --
>>> 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+u...@googlegroups.com.
>>> To post to this group, send email to prot...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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.
>

-- 
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.


Re: [protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-16 Thread Lynx Commando

First, is caffe managed by yourself? 
>No
Otherwise, I don't suggest change it by your own (may cause incompatibility 
issues).
>Unfortunately I have to
Second, this seems like a python question instead of protobuf.
>What I want to know is that if protobuf has a python api making it easier.
>>More specifically , I am looking for something equivalent to a 
boost::xml_parser that parses xml
>> In another word, I want to know if there is somepkg allows me to do the 
following thing
>>> proto = somepkg.somecls.parse("src/caffe/caffe.proto")
>>> 
proto['LayerParameter'].append(somepkg.somecls.optional_field("MyNewParam","my_new_param",param_id))
>>> for fields in my_field_list:
>>>  proto['MyNewParam'].append(field)
>>> somepkg.somecls.write(proto,"src/caffe/caffe.proto")




On Friday, June 16, 2017 at 2:21:17 AM UTC+8, Bo Yang wrote:
>
> First, is caffe managed by yourself? Otherwise, I don't suggest change it 
> by your own (may cause incompatibility issues).
> Second, this seems like a python question instead of protobuf.
>
> On Wed, Jun 14, 2017 at 8:54 PM Lynx Commando  > wrote:
>
>> More specifically, I am using caffe and I'd like to add new layers to it.
>> Then I need to modify the caffe.proto file by adding(or removing) some 
>> messages and corresponding fields to some other messages.
>> I'd want to  know if I can do this automatically with a python script.
>>
>> -- 
>> 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+u...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.


Re: [protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-15 Thread 'Bo Yang' via Protocol Buffers
First, is caffe managed by yourself? Otherwise, I don't suggest change it
by your own (may cause incompatibility issues).
Second, this seems like a python question instead of protobuf.

On Wed, Jun 14, 2017 at 8:54 PM Lynx Commando 
wrote:

> More specifically, I am using caffe and I'd like to add new layers to it.
> Then I need to modify the caffe.proto file by adding(or removing) some
> messages and corresponding fields to some other messages.
> I'd want to  know if I can do this automatically with a python script.
>
> --
> 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.
>

-- 
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.


[protobuf] Is there being a way to modify/define the .proto file with python?

2017-06-14 Thread Lynx Commando
More specifically, I am using caffe and I'd like to add new layers to it.
Then I need to modify the caffe.proto file by adding(or removing) some 
messages and corresponding fields to some other messages.
I'd want to  know if I can do this automatically with a python script.

-- 
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.