{"action":"closed","issue":{"url":"https://api.github.com/repos/google/protobuf/issues/1677","repository_url":"https://api.github.com/repos/google/protobuf","labels_url":"https://api.github.com/repos/google/protobuf/issues/1677/labels{/name}","comments_url":"https://api.github.com/repos/google/protobuf/issues/1677/comments","events_url":"https://api.github.com/repos/google/protobuf/issues/1677/events","html_url":"https://github.com/google/protobuf/issues/1677","id":159896542,"number":1677,"title":"Reading from .pbtxt format  in Ruby","user":{"login":"Arafatk","id":11155207,"avatar_url":"https://avatars.githubusercontent.com/u/11155207?v=3","gravatar_id":"","url":"https://api.github.com/users/Arafatk","html_url":"https://github.com/Arafatk","followers_url":"https://api.github.com/users/Arafatk/followers","following_url":"https://api.github.com/users/Arafatk/following{/other_user}","gists_url":"https://api.github.com/users/Arafatk/gists{/gist_id}","starred_url":"https://api.github.com/users/Arafatk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arafatk/subscriptions","organizations_url":"https://api.github.com/users/Arafatk/orgs","repos_url":"https://api.github.com/users/Arafatk/repos","events_url":"https://api.github.com/users/Arafatk/events{/privacy}","received_events_url":"https://api.github.com/users/Arafatk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-13T08:25:14Z","updated_at":"2016-06-14T18:57:29Z","closed_at":"2016-06-14T18:57:29Z","body":"I am working with protocol buffers in Tensorflow. I cannot actually replicate exactly what I am trying to do because making the shared build etc of tensorflow will take quite some time so I am just giving an overview. \r\n\r\nThis is op_def.rb file generated from [op_def.proto](https://github.com/tensorflow/tensorflow/blob/go/tensorflow/core/framework/op_def.proto)  by using ruby-protobuf\r\n```\r\n# Generated by the protocol buffer compiler.  DO NOT EDIT!\r\n# source: tensorflow/core/framework/op_def.proto\r\n\r\nrequire 'google/protobuf'\r\n\r\nrequire 'tensorflow/core/framework/attr_value'\r\nrequire 'tensorflow/core/framework/types'\r\nGoogle::Protobuf::DescriptorPool.generated_pool.build do\r\n  add_message \"tensorflow.OpDef\" do\r\n    optional :name, :string, 1\r\n    repeated :input_arg, :message, 2, \"tensorflow.OpDef.ArgDef\"\r\n    repeated :output_arg, :message, 3, \"tensorflow.OpDef.ArgDef\"\r\n    repeated :attr, :message, 4, \"tensorflow.OpDef.AttrDef\"\r\n    optional :deprecation, :message, 8, \"tensorflow.OpDeprecation\"\r\n    optional :summary, :string, 5\r\n    optional :description, :string, 6\r\n    optional :is_commutative, :bool, 18\r\n    optional :is_aggregate, :bool, 16\r\n    optional :is_stateful, :bool, 17\r\n    optional :allows_uninitialized_input, :bool, 19\r\n  end\r\n  add_message \"tensorflow.OpDef.ArgDef\" do\r\n    optional :name, :string, 1\r\n    optional :description, :string, 2\r\n    optional :type, :enum, 3, \"tensorflow.DataType\"\r\n    optional :type_attr, :string, 4\r\n    optional :number_attr, :string, 5\r\n    optional :type_list_attr, :string, 6\r\n    optional :is_ref, :bool, 16\r\n  end\r\n  add_message \"tensorflow.OpDef.AttrDef\" do\r\n    optional :name, :string, 1\r\n    optional :type, :string, 2\r\n    optional :default_value, :message, 3, \"tensorflow.AttrValue\"\r\n    optional :description, :string, 4\r\n    optional :has_minimum, :bool, 5\r\n    optional :minimum, :int64, 6\r\n    optional :allowed_values, :message, 7, \"tensorflow.AttrValue\"\r\n  end\r\n  add_message \"tensorflow.OpDeprecation\" do\r\n    optional :version, :int32, 1\r\n    optional :explanation, :string, 2\r\n  end\r\n  add_message \"tensorflow.OpList\" do\r\n    repeated :op, :message, 1, \"tensorflow.OpDef\"\r\n  end\r\nend\r\n\r\nmodule Tensorflow\r\n  OpDef = Google::Protobuf::DescriptorPool.generated_pool.lookup(\"tensorflow.OpDef\").msgclass\r\n  OpDef::ArgDef = Google::Protobuf::DescriptorPool.generated_pool.lookup(\"tensorflow.OpDef.ArgDef\").msgclass\r\n  OpDef::AttrDef = Google::Protobuf::DescriptorPool.generated_pool.lookup(\"tensorflow.OpDef.AttrDef\").msgclass\r\n  OpDeprecation = Google::Protobuf::DescriptorPool.generated_pool.lookup(\"tensorflow.OpDeprecation\").msgclass\r\n  OpList = Google::Protobuf::DescriptorPool.generated_pool.lookup(\"tensorflow.OpList\").msgclass\r\nend\r\n```\r\n    \r\n\r\nTo make use of it we can do something like \r\n`op_list = Tensorflow::OpList.new(:op => [Tensorflow::OpDef.new(:name => \"ramesh\",:summary => \"A coder\"),Tensorflow::OpDef.new(:name => \"suresh\")])\r\n`    \r\n    \r\n\r\nThis will make a Oplist from an array of OpDef.     \r\nIn one part of my project there is usage of ops which is defined in this file [here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/ops/ops.pbtxt) (ops.pbtxt )This includes the complete defination of all the ops and what I would like to do is to read from ops.pbtxt and load all the data as an oplist. This is similar to what has been done [here](https://github.com/tensorflow/tensorflow/blob/go/tensorflow/contrib/go/graph.go#L550) in go lang.\r\n\r\nI would be very grateful if you could please help me out with this."}}
{"actor":{"display_login":"Arafatk"}}