Python tensorflow.compat.v2.enable_v2_behavior() Examples

The following are 5 code examples of tensorflow.compat.v2.enable_v2_behavior(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tensorflow.compat.v2 , or try the search function .
Example #1
Source File: eval_actor.py    From valan with Apache License 2.0 6 votes vote down vote up
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) 
Example #2
Source File: saved_model_v2_predictor_test.py    From tensor2robot with Apache License 2.0 5 votes vote down vote up
def setUpModule():
  tf.enable_v2_behavior() 
Example #3
Source File: learner.py    From valan with Apache License 2.0 5 votes vote down vote up
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) 
Example #4
Source File: eval_aggregator.py    From valan with Apache License 2.0 5 votes vote down vote up
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) 
Example #5
Source File: actor.py    From valan with Apache License 2.0 5 votes vote down vote up
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)