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

Method While

tensorflow/compiler/xla/client/xla_builder.cc:1768–1787  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1766}
1767
1768XlaOp XlaBuilder::While(const XlaComputation& condition,
1769 const XlaComputation& body, XlaOp init) {
1770 return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> {
1771 HloInstructionProto instr;
1772
1773 // Infer shape.
1774 TF_ASSIGN_OR_RETURN(const auto& body_program_shape, body.GetProgramShape());
1775 TF_ASSIGN_OR_RETURN(const auto& condition_program_shape,
1776 condition.GetProgramShape());
1777 TF_ASSIGN_OR_RETURN(const Shape* init_shape, GetShapePtr(init));
1778 TF_ASSIGN_OR_RETURN(Shape shape, ShapeInference::InferWhileShape(
1779 condition_program_shape,
1780 body_program_shape, *init_shape));
1781 *instr.mutable_shape() = shape.ToProto();
1782 // Body comes before condition computation in the vector.
1783 AddCalledComputation(body, &instr);
1784 AddCalledComputation(condition, &instr);
1785 return AddInstruction(std::move(instr), HloOpcode::kWhile, {init});
1786 });
1787}
1788
1789XlaOp XlaBuilder::Gather(XlaOp input, XlaOp start_indices,
1790 const GatherDimensionNumbers& dimension_numbers,

Callers 7

RunMethod · 0.45
testWhileErrorMethod · 0.45
_scanFunction · 0.45
generate_WhileMethod · 0.45
WhileFunction · 0.45

Calls 2

mutable_shapeMethod · 0.45
ToProtoMethod · 0.45

Tested by 4

RunMethod · 0.36
testWhileErrorMethod · 0.36