lib/tensorflow/context.rb in tensorflow-0.1.2 vs lib/tensorflow/context.rb in tensorflow-0.2.0
- old
+ new
@@ -7,9 +7,33 @@
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