Sigterm was raised when no literal info is associated with constant instructions in HloProto.
PiperOrigin-RevId:
195992305
*elem_count *= dim;
}
}
- if (elem_count.has_value() && *elem_count <= 8) {
+ if (elem_count.has_value() && *elem_count <= 8 && constant->HasLiteral()) {
return Printf("%s (%s)", constant->literal().ToString(),
ShapeUtil::HumanString(constant->shape()));
}
return *literal_;
}
+bool HloInstruction::HasLiteral() const { return literal_ != nullptr; }
+
bool HloInstruction::CanHaveDimensionsField() const {
return (opcode() == HloOpcode::kReverse ||
opcode() == HloOpcode::kConcatenate ||
// Note: only constant and parameter opcodes have an associated literal.
const Literal& literal() const;
+ // Returns whether there is literal associated with this instruction.
+ bool HasLiteral() const;
+
// Returns the parameter number associated with this instruction.
//
// Note: only parameter opcodes have an associated parameter number.