Protocol Buffer
是Tensorflow主
要工具包的其中一個。python
Google
工具
處理結構化數據
ui
Protocal Buffer
序列化後獲得的數據是二進制流
,不可讀Protocal Buffer
時須要先定義數據的格式Protocal Buffer
序列化的數據比XML
格式數據小3倍以上,解析事件快20倍以上code
.proto
事件
name : 丁一
id : 000000
email : dingyi@email.comstring
message user{ optional string name = 1, required int32 id = 2, repeated string email = 3, }
每一個message
表明一類結構化數據,這裏message
裏面定義了每一個屬性的類型和名稱,屬性的類型能夠是基本類型或是另外一個message
。required
:定義一個屬性是必須
的,那麼全部message
的實例都要有這個屬性,optional
:定義一個屬性是可選
的,那麼這個屬性能夠取空,repeated
:定義一個屬性是可重複
的,那麼這個屬性的取值能夠是一個列表io