Module: Tensorflow::PythonCompatability
- Included in:
- Tensorflow
- Defined in:
- lib/tensorflow/python_compatiblity.rb
Instance Method Summary collapse
- #disable_eager_execution ⇒ Object
- #enable_eager_execution ⇒ Object
- #global_variables ⇒ Object
- #global_variables_initializer ⇒ Object
- #variables_initializer(variables, name: 'init') ⇒ Object
Instance Method Details
#disable_eager_execution ⇒ Object
17 18 19 |
# File 'lib/tensorflow/python_compatiblity.rb', line 17 def disable_eager_execution self.execution_mode = Tensorflow::GRAPH_MODE end |
#enable_eager_execution ⇒ Object
21 22 23 |
# File 'lib/tensorflow/python_compatiblity.rb', line 21 def enable_eager_execution self.execution_mode = Tensorflow::EAGER_MODE end |
#global_variables ⇒ Object
25 26 27 28 29 30 31 |
# 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 ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# 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 |