| 2587 | } |
| 2588 | |
| 2589 | XlaOp XlaBuilder::SetDimensionSize(XlaOp operand, XlaOp val, int64 dimension) { |
| 2590 | return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
| 2591 | HloInstructionProto instr; |
| 2592 | TF_ASSIGN_OR_RETURN(const Shape* operand_shape, GetShapePtr(operand)); |
| 2593 | TF_ASSIGN_OR_RETURN(Shape shape, ShapeInference::InferSetDimensionSizeShape( |
| 2594 | *operand_shape, dimension)); |
| 2595 | *instr.mutable_shape() = shape.ToProto(); |
| 2596 | instr.add_dimensions(dimension); |
| 2597 | return AddInstruction(std::move(instr), HloOpcode::kSetDimensionSize, |
| 2598 | {operand, val}); |
| 2599 | }); |
| 2600 | } |
| 2601 | |
| 2602 | StatusOr<bool> XlaBuilder::IsConstant(XlaOp operand) const { |
| 2603 | TF_RETURN_IF_ERROR(first_error_); |
no test coverage detected