Class: Tensorflow::Graph::Function

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pointer, output_types, output_shapes) ⇒ Function

Returns a new instance of Function.



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

def initialize(pointer, output_types, output_shapes)
  @pointer = pointer
  @output_types = output_types
  @output_shapes = output_shapes
end

Instance Attribute Details

#output_shapesObject (readonly)

Returns the value of attribute output_shapes.



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

def output_shapes
  @output_shapes
end

#output_typesObject (readonly)

Returns the value of attribute output_types.



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

def output_types
  @output_types
end

Instance Method Details

#function_defObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/tensorflow/graph/function.rb', line 20

def function_def
  buffer_ptr = FFI.TF_NewBuffer
  Status.check do |status|
    FFI.TF_FunctionToFunctionDef(self, buffer_ptr, status)
  end
  buffer = FFI::Buffer.new(buffer_ptr)
  string = buffer[:data].read_string(buffer[:length])
  Tensorflow::FunctionDef.decode(string)
ensure
  FFI.TF_DeleteBuffer(buffer)
end

#nameObject



15
16
17
18
# File 'lib/tensorflow/graph/function.rb', line 15

def name
  name, ptr = FFI.TF_FunctionName(self)
  name
end

#to_ptrObject



11
12
13
# File 'lib/tensorflow/graph/function.rb', line 11

def to_ptr
  @pointer
end