Class: Tensorflow::OpDefBuilder
- Inherits:
-
Object
- Object
- Tensorflow::OpDefBuilder
- Defined in:
- lib/tensorflow/op_def_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #attr(spec) ⇒ Object
-
#initialize(name) ⇒ OpDefBuilder
constructor
A new instance of OpDefBuilder.
- #input(spec) ⇒ Object
- #output(spec) ⇒ Object
- #register ⇒ Object
- #shape_inference(func) ⇒ Object
- #to_ptr ⇒ Object
Constructor Details
#initialize(name) ⇒ OpDefBuilder
Returns a new instance of OpDefBuilder.
13 14 15 16 |
# File 'lib/tensorflow/op_def_builder.rb', line 13 def initialize(name) @pointer = FFI.TF_NewOpDefinitionBuilder(name) ObjectSpace.define_finalizer(self, self.class.finalize(@pointer)) end |
Class Method Details
.finalize(pointer) ⇒ Object
7 8 9 10 11 |
# File 'lib/tensorflow/op_def_builder.rb', line 7 def self.finalize(pointer) proc do FFI::TF_DeleteOpDefinitionBuilder(pointer) end end |
.unknown_shape_inference_func ⇒ Object
3 4 5 |
# File 'lib/tensorflow/op_def_builder.rb', line 3 def self.unknown_shape_inference_func @unknown_shape_func ||= FFI.ffi_libraries.first.find_function('TF_ShapeInferenceContextSetUnknownShape') end |
Instance Method Details
#attr(spec) ⇒ Object
22 23 24 25 |
# File 'lib/tensorflow/op_def_builder.rb', line 22 def attr(spec) FFI.TF_OpDefinitionBuilderAddAttr(self, spec) self end |
#input(spec) ⇒ Object
27 28 29 30 |
# File 'lib/tensorflow/op_def_builder.rb', line 27 def input(spec) FFI.TF_OpDefinitionBuilderAddInput(self, spec) self end |
#output(spec) ⇒ Object
32 33 34 35 |
# File 'lib/tensorflow/op_def_builder.rb', line 32 def output(spec) FFI.TF_OpDefinitionBuilderAddOutput(self, spec) self end |
#register ⇒ Object
42 43 44 45 46 47 |
# File 'lib/tensorflow/op_def_builder.rb', line 42 def register ObjectSpace.undefine_finalizer(self) Status.check do |status| FFI.TF_RegisterOpDefinition(self, status) end end |
#shape_inference(func) ⇒ Object
37 38 39 40 |
# File 'lib/tensorflow/op_def_builder.rb', line 37 def shape_inference(func) FFI.TF_OpDefinitionBuilderSetShapeInferenceFunction(self, func) self end |
#to_ptr ⇒ Object
18 19 20 |
# File 'lib/tensorflow/op_def_builder.rb', line 18 def to_ptr @pointer end |