2021-11-01 10:59:53 +01:00
|
|
|
from ray.rllib.utils.annotations import override, PublicAPI
|
2020-08-15 13:24:22 +02:00
|
|
|
from ray.rllib.utils.typing import SampleBatchType
|
2018-12-12 13:57:48 -08:00
|
|
|
|
|
|
|
|
2019-01-23 21:27:26 -08:00
|
|
|
@PublicAPI
|
2020-01-02 17:42:13 -08:00
|
|
|
class OutputWriter:
|
2021-11-01 10:59:53 +01:00
|
|
|
"""Writer API for saving experiences from policy evaluation."""
|
2018-12-12 13:57:48 -08:00
|
|
|
|
2019-01-23 21:27:26 -08:00
|
|
|
@PublicAPI
|
2020-07-27 14:01:17 -07:00
|
|
|
def write(self, sample_batch: SampleBatchType):
|
2021-11-01 10:59:53 +01:00
|
|
|
"""Saves a batch of experiences.
|
2018-12-12 13:57:48 -08:00
|
|
|
|
2020-09-20 11:27:02 +02:00
|
|
|
Args:
|
2018-12-12 13:57:48 -08:00
|
|
|
sample_batch: SampleBatch or MultiAgentBatch to save.
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
2022-05-24 22:14:25 -07:00
|
|
|
@PublicAPI
|
2018-12-12 13:57:48 -08:00
|
|
|
class NoopOutput(OutputWriter):
|
|
|
|
"""Output writer that discards its outputs."""
|
|
|
|
|
|
|
|
@override(OutputWriter)
|
2020-07-27 14:01:17 -07:00
|
|
|
def write(self, sample_batch: SampleBatchType):
|
2021-11-01 10:59:53 +01:00
|
|
|
# Do nothing.
|
2018-12-12 13:57:48 -08:00
|
|
|
pass
|