MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / HandleWhile

Method HandleWhile

tensorflow/compiler/xla/service/hlo_verifier.cc:807–829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807Status ShapeVerifier::HandleWhile(HloInstruction* xla_while) {
808 TF_RETURN_IF_ERROR(
809 CheckParameterCount(xla_while, xla_while->while_body(), 1));
810 TF_RETURN_IF_ERROR(
811 CheckParameterCount(xla_while, xla_while->while_condition(), 1));
812 TF_RETURN_IF_ERROR(
813 CheckOperandAndParameter(xla_while, 0, xla_while->while_body(), 0));
814 TF_RETURN_IF_ERROR(
815 CheckOperandAndParameter(xla_while, 0, xla_while->while_condition(), 0));
816 const Shape& conditional_shape =
817 xla_while->while_condition()->root_instruction()->shape();
818 if (!ShapeUtil::Compatible(conditional_shape,
819 ShapeUtil::MakeShape(PRED, {}))) {
820 return InternalError(
821 "Conditional computation shape does not lead to a scalar predicate "
822 "shape: %s",
823 StringifyShape(conditional_shape));
824 }
825 // The shape of kWhile should match the shape of the body computation it
826 // calls.
827 return CheckShape(xla_while,
828 xla_while->while_body()->root_instruction()->shape());
829}
830
831Status ShapeVerifier::HandleConditional(HloInstruction* conditional) {
832 if (!ShapeUtil::IsScalar(conditional->operand(0)->shape())) {

Callers 1

VisitMethod · 0.45

Calls 9

CheckParameterCountFunction · 0.85
CompatibleClass · 0.85
MakeShapeFunction · 0.85
StringifyShapeFunction · 0.85
while_conditionMethod · 0.80
root_instructionMethod · 0.80
InternalErrorFunction · 0.50
while_bodyMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected