Sha256: 8b7cdb7f462e1d7b4d4ec850a1d4ff0f3106dfa238feff905f057f19a0bdfbfa
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
module TensorFlow class Context 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 def function?(name) FFI.TFE_ContextHasFunction(@pointer, name) != 0 end def device_policy FFI::ContextDevicePlacementPolicy[FFI.TFE_ContextGetDevicePlacementPolicy(@pointer)] end def enable_run_metadata FFI.TFE_ContextEnableRunMetadata(@pointer) end def disable_run_metadata FFI.TFE_ContextDisableRunMetadata(@pointer) end def start_step FFI.TFE_ContextStartStep(@pointer) end def end_step FFI.TFE_ContextEndStep(@pointer) end def self.finalize(pointer) # must use proc instead of stabby lambda proc { FFI.TFE_DeleteContext(pointer) } end def to_ptr @pointer end def shared_name # hard-coded in Python library "cd2c89b7-88b7-44c8-ad83-06c2a9158347" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tensorflow-0.2.0 | lib/tensorflow/context.rb |