本文整理汇总了Python中tensorflow.compat.v2.enable_v2_behavior方法的典型用法代码示例。如果您正苦于以下问题:Python v2.enable_v2_behavior方法的具体用法?Python v2.enable_v2_behavior怎么用?Python v2.enable_v2_behavior使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.compat.v2
的用法示例。
在下文中一共展示了v2.enable_v2_behavior方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from tensorflow.compat import v2 [as 别名]
# 或者: from tensorflow.compat.v2 import enable_v2_behavior [as 别名]
def run(problem_type, max_iter=-1, num_episodes_per_iter=45):
"""Runs the eval_actor with the given problem type.
Args:
problem_type: An instance of `framework_problem_type.ProblemType`.
max_iter: Number of iterations after which the actor must stop. The default
value of -1 means run indefinitely.
num_episodes_per_iter: Number of episodes to execute per iteration.
"""
assert isinstance(problem_type, framework_problem_type.ProblemType)
tf.enable_v2_behavior()
hparams = {}
hparams['logdir'] = FLAGS.logdir
# In the eval actor, max_iter is only for use unit tests. (It is the learner's
# job to terminate execution.)
hparams['max_iter'] = max_iter
hparams['num_episodes_per_iter'] = num_episodes_per_iter
run_with_aggregator(problem_type, FLAGS.server_address, hparams)
示例2: setUpModule
# 需要导入模块: from tensorflow.compat import v2 [as 别名]
# 或者: from tensorflow.compat.v2 import enable_v2_behavior [as 别名]
def setUpModule():
tf.enable_v2_behavior()
示例3: run
# 需要导入模块: from tensorflow.compat import v2 [as 别名]
# 或者: from tensorflow.compat.v2 import enable_v2_behavior [as 别名]
def run(problem_type: framework_problem_type.ProblemType):
"""Runs the learner with the given problem type."""
tf.enable_v2_behavior()
iter_frame_ratio = FLAGS.batch_size * FLAGS.unroll_length
final_iteration = int(
math.ceil(FLAGS.total_environment_frames / iter_frame_ratio))
hparams = {}
hparams['logdir'] = FLAGS.logdir
hparams['iter_frame_ratio'] = iter_frame_ratio
hparams['final_iteration'] = final_iteration
run_with_address(problem_type, FLAGS.server_address, hparams)
示例4: run
# 需要导入模块: from tensorflow.compat import v2 [as 别名]
# 或者: from tensorflow.compat.v2 import enable_v2_behavior [as 别名]
def run(aggregator_prefix='default'):
"""Run the eval_aggregator."""
tf.enable_v2_behavior()
hparams = {}
logdir = FLAGS.logdir
if aggregator_prefix:
logdir = os.path.join(logdir, aggregator_prefix)
hparams['logdir'] = logdir
hparams['num_samples'] = -1
run_with_address(FLAGS.server_address, hparams)
示例5: run
# 需要导入模块: from tensorflow.compat import v2 [as 别名]
# 或者: from tensorflow.compat.v2 import enable_v2_behavior [as 别名]
def run(problem_type: framework_problem_type.ProblemType):
"""Runs the actor with the given problem type."""
tf.enable_v2_behavior()
hparams = {}
# In the actor, max_iter is only for use unit tests. (It is the learner's job
# to terminate execution.)
hparams['max_iter'] = -1 # -1 means infinite
hparams['sync_agent_every_n_steps'] = FLAGS.sync_agent_every_n_steps
run_with_learner(problem_type, FLAGS.server_address, hparams)