Class: Tensorflow::Graph::OperationOutput

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, output) ⇒ OperationOutput

Returns a new instance of OperationOutput.



24
25
26
27
# File 'lib/tensorflow/graph/operation_output.rb', line 24

def initialize(operation, output)
  @operation = operation
  @output = output
end

Instance Attribute Details

#operationObject (readonly)

Returns the value of attribute operation.



4
5
6
# File 'lib/tensorflow/graph/operation_output.rb', line 4

def operation
  @operation
end

#outputObject (readonly)

Returns the value of attribute output.



4
5
6
# File 'lib/tensorflow/graph/operation_output.rb', line 4

def output
  @output
end

Class Method Details

.from_graph(graph, pointer) ⇒ Object



18
19
20
21
22
# File 'lib/tensorflow/graph/operation_output.rb', line 18

def self.from_graph(graph, pointer)
  output = FFI::Output.new(pointer)
  operation = Operation.new(graph, output[:oper])
  self.new(operation, output)
end

.from_index(operation, index) ⇒ Object



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

def self.from_index(operation, index)
  output = FFI::Output.new
  output[:index] = index
  output[:oper] = operation
  self.new(operation, output)
end

.from_pointer(operation, pointer) ⇒ Object



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

def self.from_pointer(operation, pointer)
  output = FFI::Output.new(pointer)
  self.new(operation, output)
end

Instance Method Details

#indexObject



33
34
35
# File 'lib/tensorflow/graph/operation_output.rb', line 33

def index
  self.output[:index]
end

#to_ptrObject



29
30
31
# File 'lib/tensorflow/graph/operation_output.rb', line 29

def to_ptr
  @output.to_ptr
end

#to_sObject



37
38
39
40
41
42
43
44
45
46
# File 'lib/tensorflow/graph/operation_output.rb', line 37

def to_s
  if self.output
    result = [self.operation.op_type]
    result << "name=#{self.operation.name}"
    result << "#{self.index}:(shape=#{self.operation.output_shapes[self.index]}, dtype=#{self.operation.output_types[self.index]})"
    result.join(', ')
  else
    super
  end
end