garage.tf.samplers.worker

Default TensorFlow sampler Worker.

class TFWorkerClassWrapper(wrapped_class)

Acts like a Worker class, but is actually an object.

When called, constructs the wrapped class and wraps it in a TFWorkerWrapper.

Parameters

wrapped_class (type) – The class to wrap. Should be a subclass of Worker.

class TFWorkerWrapper

Bases: garage.sampler.worker.Worker

Inheritance diagram of garage.tf.samplers.worker.TFWorkerWrapper

Wrapper around another workers that initializes a TensorFlow Session.

property agent

the worker’s agent.

Type

Policy

property env

Worker’s environment.

Type

Environment

worker_init()

Initialize a worker.

shutdown()

Perform shutdown processes for TF.

update_agent(agent_update)

Update the worker’s agent, using agent_update.

Parameters

agent_update (object) – An agent update. The exact type of this argument depends on the Worker implementation.

update_env(env_update)

Update the worker’s env, using env_update.

Parameters

env_update (object) – An environment update. The exact type of this argument depends on the Worker implementation.

rollout()

Sample a single episode of the agent in the environment.

Returns

Batch of sampled episodes. May be truncated if

max_episode_length is set.

Return type

EpisodeBatch

start_episode()

Begin a new episode.

step_episode()

Take a single time-step in the current episode.

Returns

True iff the episode is done, either due to the environment

indicating termination of due to reaching max_episode_length.

Return type

bool

collect_episode()

Collect the current episode, clearing the internal buffer.

Returns

Batch of sampled episodes. May be truncated if the

episodes haven’t completed yet.

Return type

EpisodeBatch