Class: TensorStream::Pbtext
- Inherits:
-
Object
- Object
- TensorStream::Pbtext
- Defined in:
- lib/tensor_stream/graph_serializers/pbtext.rb
Instance Method Summary collapse
- #get_string(graph) ⇒ Object
-
#initialize ⇒ Pbtext
constructor
A new instance of Pbtext.
- #serialize(session, filename, tensor) ⇒ Object
Constructor Details
#initialize ⇒ Pbtext
Returns a new instance of Pbtext.
3 4 |
# File 'lib/tensor_stream/graph_serializers/pbtext.rb', line 3 def initialize end |
Instance Method Details
#get_string(graph) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tensor_stream/graph_serializers/pbtext.rb', line 9 def get_string(graph) @lines = [] graph.nodes.each do |k, node| @lines << "node {" @lines << " name: #{node.name.to_json}" if node.is_a?(TensorStream::Operation) @lines << " op: #{node.operation.to_json}" node.items.each do |input| next unless input @lines << " input: #{input.name.to_json}" end # type pb_attr('T', sym_to_protobuf_type(node.data_type)) elsif node.is_a?(TensorStream::Tensor) && node.is_const @lines << " op: \"Const\"" # type pb_attr('T', sym_to_protobuf_type(node.data_type)) pb_attr('value', tensor_value(node)) end @lines << "}" end @lines.join("\n") end |
#serialize(session, filename, tensor) ⇒ Object
6 7 |
# File 'lib/tensor_stream/graph_serializers/pbtext.rb', line 6 def serialize(session, filename, tensor) end |