| 1175 | } |
| 1176 | |
| 1177 | Status BundleReader::ReadCurrent(Tensor* val) { |
| 1178 | CHECK(val != nullptr); |
| 1179 | BundleEntryProto entry; |
| 1180 | TF_RETURN_IF_ERROR(ParseEntryProto(iter_->key(), iter_->value(), &entry)); |
| 1181 | if (!TensorShape::IsValid(entry.shape())) { |
| 1182 | return errors::DataLoss("Invalid tensor shape: ", iter_->key(), " ", |
| 1183 | ProtoShortDebugString(entry.shape())); |
| 1184 | } |
| 1185 | |
| 1186 | if (entry.slices().empty()) { |
| 1187 | return GetValue(entry, val); |
| 1188 | } else { |
| 1189 | return GetSliceValue( |
| 1190 | iter_->key(), entry, |
| 1191 | /* a full slice */ TensorSlice(TensorShape(entry.shape()).dims()), val); |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | Status BundleReader::LookupTensorSlices(StringPiece key, |
| 1196 | std::vector<TensorSlice>* slices) { |