Class: TensorFlow::Context
- Inherits:
-
Object
- Object
- TensorFlow::Context
- Defined in:
- lib/tensorflow/context.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Context
constructor
A new instance of Context.
- #shared_name ⇒ Object
- #to_ptr ⇒ Object
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
3 4 5 6 7 8 9 10 |
# File 'lib/tensorflow/context.rb', line 3 def initialize = FFI.TFE_NewContextOptions @status = TensorFlow::FFI.TF_NewStatus @pointer = FFI.TFE_NewContext(, @status) Utils.check_status @status ObjectSpace.define_finalizer(self, self.class.finalize(@pointer)) FFI.TFE_DeleteContextOptions() end |
Class Method Details
.finalize(pointer) ⇒ Object
12 13 14 15 |
# File 'lib/tensorflow/context.rb', line 12 def self.finalize(pointer) # must use proc instead of stabby lambda proc { FFI.TFE_DeleteContext(pointer) } end |
Instance Method Details
#shared_name ⇒ Object
21 22 23 24 |
# File 'lib/tensorflow/context.rb', line 21 def shared_name # hard-coded in Python library "cd2c89b7-88b7-44c8-ad83-06c2a9158347" end |
#to_ptr ⇒ Object
17 18 19 |
# File 'lib/tensorflow/context.rb', line 17 def to_ptr @pointer end |