# Buggy code
def learn_on_batch(self, samples: SampleBatchType) -> dict:
    """Update policies based on the given batch.

    This is the equivalent to apply_gradients(compute_gradients(samples)),
    but can be optimized to avoid pulling gradients into CPU memory.

    Returns:
        info: dictionary of extra metadata from compute_gradients().

    Examples:
        >>> batch = worker.sample()
        >>> worker.learn_on_batch(samples)
    """
    if log_once("learn_on_batch"):
        logger.info(
            "Training on concatenated sample batches:\n\n{}\n".format(
                summarize(samples)
            )
        )
    if isinstance(samples, MultiAgentBatch):
        info_out = {}
        to_fetch = {}
        if self.tf_sess is not None:
            builder = TFRunBuilder(self.tf_sess, "learn_on_batch")
        else:
            builder = None
        for pid, batch in samples.policy_batches.items():
            if pid not in self.policies_to_train:
                continue
            policy = self.policy_map[pid]
            if builder and hasattr(policy, "_build_learn_on_batch"):
                to_fetch[pid] = policy._build_learn_on_batch(builder, batch)
            else:
                info_out[pid] = policy.learn_on_batch(batch)
        info_out.update({k: builder.get(v) for k, v in to_fetch.items()})
    else:
        info_out = {
            DEFAULT_POLICY_ID: self.policy_map[DEFAULT_POLICY_ID].learn_on_batch(
                samples
            )
        }
    if log_once("learn_out"):
        logger.debug("Training out:\n\n{}\n".format(summarize(info_out)))
    return info_out


# Traceback (ValueError)
Traceback (most recent call last):
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/tune/trial_runner.py", line 519, in _process_trial
result = self.trial_executor.fetch_result(trial)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/tune/ray_trial_executor.py", line 497, in fetch_result
result = ray.get(trial_future[0], timeout=DEFAULT_GET_TIMEOUT)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/worker.py", line 1379, in get
raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(ValueError): ray::PPO.train() (pid=50904, ip=129.2.189.150)
File "python/ray/_raylet.pyx", line 463, in ray._raylet.execute_task
File "python/ray/_raylet.pyx", line 415, in ray._raylet.execute_task.function_executor
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/rllib/agents/trainer.py", line 508, in train
raise e
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/rllib/agents/trainer.py", line 494, in train
result = Trainable.train(self)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/tune/trainable.py", line 183, in train
result = self.step()
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/rllib/agents/trainer_template.py", line 147, in step
res = next(self.train_exec_impl)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 756, in __next__
return next(self.built_iterator)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 783, in apply_foreach
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 783, in apply_foreach
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 843, in apply_filter
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 843, in apply_filter
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 783, in apply_foreach
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 783, in apply_foreach
for item in it:
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/util/iter.py", line 791, in apply_foreach
result = fn(item)
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/rllib/execution/train_ops.py", line 191, in __call__
[tuples[k] for k in state_keys]))
File "/home/justinkterry/.local/lib/python3.6/site-packages/ray/rllib/execution/multi_gpu_impl.py", line 218, in load_data
sess.run([t.init_op for t in self._towers], feed_dict=feed_dict)
File "/home/justinkterry/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 950, in run
run_metadata_ptr)
File "/home/justinkterry/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1142, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "/home/justinkterry/.local/lib/python3.6/site-packages/numpy/core/_asarray.py", line 83, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: could not convert string to float: 'B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BADwBd8MHj9Ep1E/rZQ6P6oOAj87bvI+BAC//F/yPq7jET+0uF+UAQbi95VoP4uhGj/sPO8+biAEAPEESaUCP0N5TT+sL18/1WcgP27EDwQA8QhQrBA/RiMsP6c8az9KYTs/AQsXP8iKFgQAAAwAABQA8QCJAnk/tMh/P3xgYz+Ctl0EAGJrCHo/ou2IFwB8FwBAAQAEAACUFwC4AfEACul4P1VRNT9FGPY+oBXwBABxhN3xPkqzMRwAACQAACwAADQAAAQAAEQAABQADwQA////////////////////////b2+Z13U/l4FAFCcMsBIAzBJ/BZxfP+wyboQvMgBMFAQEAACELy86SKwAKwRMAAQIAC9JFzAvKwRIAAgIACLtuuATDBwBDxAAEQBAAQQEAL94J1o/r5E6P0klP+wUBg9UAA0EtBcAfC+v13ETP58HMz/hyHAXJwi0FwT0AADIFA+IAA0PIAAFBEQACAgAP2gIafAAJgQ8AQgIAD9MfXNQACYImAAADABvm3JiP3/3hAInAEQABAQAAIAvLygUHDAnAFQBBOgAAJgAL/gQTAArAFAA/wxEbU0/R6ouP1HyMz/ACjU/6AM1PyhPQD+nuHJEAQYAnC8ApC8EsC8ACADxBGRLYz+8OHg/VoNBP2Vu7D7JEssEAL/5A8s+WoIIPyo6X1AABqKeP1Q/kqMDP05KtC8AvC/xBJJT2D6jKzI/SWZ/P/tQbz+9slcEAHGEalw/cTV1pBcArBcAtBcMwBe1TMB3P8rdWT9lrUK4L3H7G04/yql0hAAAfBcESAEEzAIApBcPwBchMZSMBXBH8RaUjAVkdHlwZZSTlIwCZjSUiYiHlFKUKEsDjAE8lE5OTkr/////BQDwBEsAdJRiTdARhZSMAUOUdJRSlC4AAAAA'
Result for PPO_pistonball_v3_f4d39_00000:
{}

# Fixed code
def learn_on_batch(self, samples: SampleBatchType) -> dict:
    """Update policies based on the given batch.

    This is the equivalent to apply_gradients(compute_gradients(samples)),
    but can be optimized to avoid pulling gradients into CPU memory.

    Returns:
        info: dictionary of extra metadata from compute_gradients().

    Examples:
        >>> batch = worker.sample()
        >>> worker.learn_on_batch(samples)
    """
    if log_once("learn_on_batch"):
        logger.info(
            "Training on concatenated sample batches:\n\n{}\n".format(
                summarize(samples)
            )
        )
    if isinstance(samples, MultiAgentBatch):
        info_out = {}
        to_fetch = {}
        if self.tf_sess is not None:
            builder = TFRunBuilder(self.tf_sess, "learn_on_batch")
        else:
            builder = None
        for pid, batch in samples.policy_batches.items():
            if pid not in self.policies_to_train:
                continue
            # Decompress SampleBatch, in case some columns are compressed.
            batch.decompress_if_needed()
            policy = self.policy_map[pid]
            if builder and hasattr(policy, "_build_learn_on_batch"):
                to_fetch[pid] = policy._build_learn_on_batch(builder, batch)
            else:
                info_out[pid] = policy.learn_on_batch(batch)
        info_out.update({k: builder.get(v) for k, v in to_fetch.items()})
    else:
        info_out = {
            DEFAULT_POLICY_ID: self.policy_map[DEFAULT_POLICY_ID].learn_on_batch(
                samples
            )
        }
    if log_once("learn_out"):
        logger.debug("Training out:\n\n{}\n".format(summarize(info_out)))
    return info_out