| 39 | ResourceHandle::~ResourceHandle() {} |
| 40 | |
| 41 | void ResourceHandle::AsProto(ResourceHandleProto* proto) const { |
| 42 | proto->set_device(device()); |
| 43 | proto->set_container(container()); |
| 44 | proto->set_name(name()); |
| 45 | proto->set_hash_code(hash_code()); |
| 46 | proto->set_maybe_type_name(maybe_type_name()); |
| 47 | for (const auto& dtype_and_shape_pair : dtypes_and_shapes_) { |
| 48 | auto dtype_and_shape = proto->add_dtypes_and_shapes(); |
| 49 | dtype_and_shape->set_dtype(dtype_and_shape_pair.dtype); |
| 50 | dtype_and_shape_pair.shape.AsProto(dtype_and_shape->mutable_shape()); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | Status ResourceHandle::FromProto(const ResourceHandleProto& proto) { |
| 55 | set_device(proto.device()); |
no test coverage detected