| 947 | } |
| 948 | |
| 949 | Status BundleReader::GetBundleEntryProto(StringPiece key, |
| 950 | BundleEntryProto* entry) { |
| 951 | entry->Clear(); |
| 952 | TF_CHECK_OK(status_); |
| 953 | Seek(key); |
| 954 | if (!iter_->Valid() || iter_->key() != key) { |
| 955 | return errors::NotFound("Key ", key, " not found in checkpoint"); |
| 956 | } |
| 957 | |
| 958 | BundleEntryProto entry_copy; |
| 959 | TF_RETURN_IF_ERROR( |
| 960 | ParseEntryProto(iter_->key(), iter_->value(), &entry_copy)); |
| 961 | if (!TensorShape::IsValid(entry_copy.shape())) { |
| 962 | return errors::DataLoss("Invalid tensor shape: ", key, " ", |
| 963 | ProtoShortDebugString(entry_copy.shape())); |
| 964 | } |
| 965 | |
| 966 | *entry = entry_copy; |
| 967 | return Status::OK(); |
| 968 | } |
| 969 | |
| 970 | Status BundleReader::GetValue(const BundleEntryProto& entry, Tensor* val) { |
| 971 | Tensor* ret = val; |