def __init__(self, max_iterations, unroll_loop=False):
"""
Creates a new iterative solver instance.
Args:
max_iterations: Maximum number of iterations before termination.
unroll_loop: Unrolls the TensorFlow while loop if true.
"""
assert max_iterations >= 0
self.max_iterations = max_iterations
assert isinstance(unroll_loop, bool)
self.unroll_loop = unroll_loop
super(Iterative, self).__init__()
# TensorFlow functions
self.initialize = tf.make_template(name_='initialize', func_=self.tf_initialize)
self.step = tf.make_template(name_='step', func_=self.tf_step)
self.next_step = tf.make_template(name_='next-step', func_=self.tf_next_step)
评论列表
文章目录