def test_ref_assign(self):
# Currently ngraph and tf have different assign semantics
# eval(ng.assign(a, 1)) resturns None, but eval(tf.assign(a, 1)) returns
# a which is 1.
# TODO: fix this test after assign op / user_deps are fixed in ngraph
# TODO: double assignments fails
# tf placeholder
a = tf.Variable(tf.constant(np.random.randn(2, 3), name="a"))
b = tf.Variable(tf.constant(np.random.randn(2, 3), name="b"))
init_op = tf.global_variables_initializer()
a_update = tf.assign(a, b)
# test
tf_result = self.tf_run(a_update, tf_init_op=init_op)
ng_result = self.ng_run(a)
ng.testing.assert_allclose(tf_result, ng_result)
评论列表
文章目录