class TensorFlow::Context
Public Class Methods
finalize(pointer)
click to toggle source
# File lib/tensorflow/context.rb, line 36 def self.finalize(pointer) # must use proc instead of stabby lambda proc { FFI.TFE_DeleteContext(pointer) } end
new()
click to toggle source
# File lib/tensorflow/context.rb, line 3 def initialize options = FFI.TFE_NewContextOptions @status = TensorFlow::FFI.TF_NewStatus @pointer = FFI.TFE_NewContext(options, @status) Utils.check_status @status ObjectSpace.define_finalizer(self, self.class.finalize(@pointer)) FFI.TFE_DeleteContextOptions(options) end
Public Instance Methods
device_policy()
click to toggle source
# File lib/tensorflow/context.rb, line 16 def device_policy FFI::ContextDevicePlacementPolicy[FFI.TFE_ContextGetDevicePlacementPolicy(@pointer)] end
disable_run_metadata()
click to toggle source
# File lib/tensorflow/context.rb, line 24 def disable_run_metadata FFI.TFE_ContextDisableRunMetadata(@pointer) end
enable_run_metadata()
click to toggle source
# File lib/tensorflow/context.rb, line 20 def enable_run_metadata FFI.TFE_ContextEnableRunMetadata(@pointer) end
end_step()
click to toggle source
# File lib/tensorflow/context.rb, line 32 def end_step FFI.TFE_ContextEndStep(@pointer) end
function?(name)
click to toggle source
# File lib/tensorflow/context.rb, line 12 def function?(name) FFI.TFE_ContextHasFunction(@pointer, name) != 0 end
start_step()
click to toggle source
# File lib/tensorflow/context.rb, line 28 def start_step FFI.TFE_ContextStartStep(@pointer) end
to_ptr()
click to toggle source
# File lib/tensorflow/context.rb, line 41 def to_ptr @pointer end