in compiler_gym/validation_result.py [0:0]
def join(cls, results: Iterable["ValidationResult"]):
"""Create a validation result that is the union join of multiple results."""
results = list(results)
if not results:
raise ValueError("No states to join")
if any(r.state != results[0].state for r in results[1:]):
raise ValueError("All states must be the same")
return cls(
# NOTE: No checking that states are the same.
state=results[0].state,
walltime=sum(r.walltime for r in results),
reward_validated=any(r.reward_validated for r in results),
actions_replay_failed=any(r.actions_replay_failed for r in results),
reward_validation_failed=any(r.reward_validation_failed for r in results),
benchmark_semantics_validated=any(
r.benchmark_semantics_validated for r in results
),
benchmark_semantics_validation_failed=any(
r.benchmark_semantics_validation_failed for r in results
),
errors=list(itertools.chain.from_iterable(r.errors for r in results)),
)