Have the HloEvaluator print out intermediate values on VLOG(100)

This is useful for tracing through very small HLO programs.

PiperOrigin-RevId: 317432566
Change-Id: I1b70ed0f81ed57915ecccaf8cb85fefc857e2151
This commit is contained in:
Sanjoy Das 2020-06-19 22:10:56 -07:00 committed by TensorFlower Gardener
parent 8efcda9caa
commit 7f2bfd5709

View File

@ -274,6 +274,13 @@ StatusOr<Literal> HloEvaluator::Evaluate(
engine_.seed(seed_);
TF_RETURN_IF_ERROR(computation.Accept(this));
if (VLOG_IS_ON(100)) {
for (const HloInstruction* instr : computation.instructions()) {
VLOG(100) << instr->name() << " = " << GetEvaluatedLiteralFor(instr);
}
}
return GetEvaluatedLiteralFor(computation.root_instruction()).Clone();
}