Add an error message when HLO casting fails.

PiperOrigin-RevId: 358236260
Change-Id: I3085b13d9f3a7324b73546d2abffafa24694eb71
This commit is contained in:
Yunxing Dai 2021-02-18 12:19:12 -08:00 committed by TensorFlower Gardener
parent 27572e0ad4
commit 52a0e1534c

View File

@ -39,7 +39,9 @@ template <class T, EnableIfDerivedFromHlo<T>* = nullptr>
const T* Cast(const HloInstruction* instruction) {
CHECK(instruction != nullptr);
const T* casted = dynamic_cast<const T*>(instruction);
CHECK(casted != nullptr);
CHECK(casted != nullptr)
<< "Invalid HloInstruction casting. Destination Type: "
<< typeid(T).name();
return casted;
}