Class: Tensorflow::Printers::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/tensorflow/printers/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph) ⇒ Graph

Returns a new instance of Graph.



8
9
10
# File 'lib/tensorflow/printers/graph.rb', line 8

def initialize(graph)
  @graph = graph
end

Instance Attribute Details

#graphObject (readonly)

Returns the value of attribute graph.



6
7
8
# File 'lib/tensorflow/printers/graph.rb', line 6

def graph
  @graph
end

Instance Method Details



19
20
21
22
23
# File 'lib/tensorflow/printers/graph.rb', line 19

def print(io_stream=STDOUT)
  #io_stream << ERB.new(self.template, nil, trim_mode: "<>").result_with_hash(:graph => self.graph)

  raw = Erubi::Engine.new(self.template, filename: 'graph.erb')
  io_stream << eval(raw.src)
end

#templateObject



12
13
14
15
16
17
# File 'lib/tensorflow/printers/graph.rb', line 12

def template
  @template ||= begin
    path = File.join(__dir__, 'graph.erb')
    File.read(path, :mode => 'rb')
  end
end