| 69 | } |
| 70 | |
| 71 | Status AssignLayout( |
| 72 | absl::Span<const int64> minor_to_major, |
| 73 | const std::function<xla::Layout(const xla::Shape&)>& layout_func, |
| 74 | xla::Shape* shape) { |
| 75 | xla::Layout layout; |
| 76 | TF_ASSIGN_OR_RETURN(bool has_layout, MakeLayout(minor_to_major, &layout)); |
| 77 | if (!has_layout && layout_func) { |
| 78 | layout = layout_func(*shape); |
| 79 | } |
| 80 | *shape->mutable_layout() = layout; |
| 81 | return Status::OK(); |
| 82 | } |
| 83 | |
| 84 | } // namespace |
| 85 |
no test coverage detected