| 52 | } |
| 53 | |
| 54 | LogicalBufferProto BufferValue::ToProto(const SizeFunction& size_fn) const { |
| 55 | LogicalBufferProto proto; |
| 56 | proto.set_id(id()); |
| 57 | proto.set_size(size_fn(*this)); |
| 58 | LogicalBufferProto::Location proto_location = |
| 59 | ToLocationProto(*instruction(), index()); |
| 60 | proto.mutable_defined_at()->Swap(&proto_location); |
| 61 | if (has_color()) { |
| 62 | proto.set_color(color().value()); |
| 63 | } |
| 64 | return proto; |
| 65 | } |
| 66 | |
| 67 | } // namespace xla |