Fixed lbfgs for ray-cluster (#180)

* Updated lbfgs example to include TensorflowVariables

* Whitespace.
This commit is contained in:
Wapaul1
2017-01-10 18:40:06 -08:00
committed by Philipp Moritz
parent be4a37bf37
commit aaf3be3c53
3 changed files with 141 additions and 97 deletions
+11
View File
@@ -5,6 +5,7 @@ from __future__ import print_function
import unittest
import tensorflow as tf
import ray
from numpy.testing import assert_almost_equal
class TensorFlowTest(unittest.TestCase):
@@ -47,6 +48,16 @@ class TensorFlowTest(unittest.TestCase):
variables2.set_weights(weights2)
self.assertEqual(weights2, variables2.get_weights())
flat_weights = variables2.get_flat() + 2.0
variables2.set_flat(flat_weights)
assert_almost_equal(flat_weights, variables2.get_flat())
variables3 = ray.experimental.TensorFlowVariables(loss2)
self.assertEqual(variables3.sess, None)
sess = tf.Session()
variables3.set_session(sess)
self.assertEqual(variables3.sess, sess)
ray.worker.cleanup()
if __name__ == "__main__":