module Tensorflow::PythonCompatability
Public Instance Methods
disable_eager_execution()
click to toggle source
# File lib/tensorflow/python_compatiblity.rb, line 17 def disable_eager_execution self.execution_mode = Tensorflow::GRAPH_MODE end
enable_eager_execution()
click to toggle source
# File lib/tensorflow/python_compatiblity.rb, line 21 def enable_eager_execution self.execution_mode = Tensorflow::EAGER_MODE end
global_variables()
click to toggle source
# File lib/tensorflow/python_compatiblity.rb, line 25 def global_variables if ExecutionContext.eager? [] else ExecutionContext.current.get_collection_ref(Graph::GraphKeys::GLOBAL_VARIABLES) end end
global_variables_initializer()
click to toggle source
# File lib/tensorflow/python_compatiblity.rb, line 33 def global_variables_initializer if ExecutionContext.eager? RawOps.no_op else global_variables = ExecutionContext.current.get_collection_ref(Graph::GraphKeys::GLOBAL_VARIABLES) global_variables = Array(global_variables) if global_variables.length > 0 self.variables_initializer(global_variables) end end end
variables_initializer(variables, name: 'init')
click to toggle source
# File lib/tensorflow/python_compatiblity.rb, line 45 def variables_initializer(variables, name: 'init') if ExecutionContext.eager? RawOps.no_op else Control.group(variables.map(&:initializer)) end end