MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / HasTensor

Method HasTensor

tensorflow/core/util/tensor_slice_reader.cc:205–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203TensorSliceReader::~TensorSliceReader() { gtl::STLDeleteValues(&tensors_); }
204
205bool TensorSliceReader::HasTensor(const string& name, TensorShape* shape,
206 DataType* type) const {
207 mutex_lock l(mu_);
208 const TensorSliceSet* tss = gtl::FindPtrOrNull(tensors_, name);
209 if (!tss && !all_shards_loaded_) {
210 VLOG(1) << "Did not find tensor in preferred shard, loading all shards: "
211 << name;
212 LoadAllShards();
213 tss = gtl::FindPtrOrNull(tensors_, name);
214 }
215 if (tss) {
216 if (shape) {
217 *shape = tss->shape();
218 }
219 if (type) {
220 *type = tss->type();
221 }
222 return true;
223 } else {
224 return false;
225 }
226}
227
228Status TensorSliceReader::GetTensor(
229 const string& name, std::unique_ptr<tensorflow::Tensor>* out_tensor) const {

Callers 6

TEST_FFunction · 0.45
RestoreTensorFunction · 0.45
SimpleFloatHelperFunction · 0.45
SimpleIntXHelperFunction · 0.45
TESTFunction · 0.45

Calls 3

FindPtrOrNullFunction · 0.85
typeMethod · 0.65
shapeMethod · 0.45

Tested by 5

TEST_FFunction · 0.36
SimpleFloatHelperFunction · 0.36
SimpleIntXHelperFunction · 0.36
TESTFunction · 0.36