| 1574 | } |
| 1575 | |
| 1576 | XlaOp XlaBuilder::Transpose(XlaOp operand, |
| 1577 | absl::Span<const int64> permutation) { |
| 1578 | return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
| 1579 | HloInstructionProto instr; |
| 1580 | TF_ASSIGN_OR_RETURN(const Shape* operand_shape, GetShapePtr(operand)); |
| 1581 | TF_ASSIGN_OR_RETURN(Shape shape, ShapeInference::InferTransposeShape( |
| 1582 | *operand_shape, permutation)); |
| 1583 | *instr.mutable_shape() = shape.ToProto(); |
| 1584 | for (int64 dim : permutation) { |
| 1585 | instr.add_dimensions(dim); |
| 1586 | } |
| 1587 | return AddInstruction(std::move(instr), HloOpcode::kTranspose, {operand}); |
| 1588 | }); |
| 1589 | } |
| 1590 | |
| 1591 | XlaOp XlaBuilder::Rev(XlaOp operand, absl::Span<const int64> dimensions) { |
| 1592 | return ReportErrorOrReturn([&]() -> StatusOr<XlaOp> { |
no test coverage detected