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

Method DoCreate

tensorflow/core/framework/resource_mgr.cc:170–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170Status ResourceMgr::DoCreate(const string& container, TypeIndex type,
171 const string& name, ResourceBase* resource) {
172 Container** b = &containers_[container];
173 if (*b == nullptr) {
174 *b = new Container;
175 }
176
177 // NOTE: Separating out the construction of the map key and value so that the
178 // key can contain a StringPiece that borrows from the string in the value.
179 ResourceAndName resource_and_name(resource, name);
180 StringPiece borrowed_name(*resource_and_name.name);
181 Container::value_type key_and_value(Key(type.hash_code(), std::string(borrowed_name.data(), borrowed_name.size())),
182 std::move(resource_and_name));
183
184 if ((*b)->insert(std::move(key_and_value)).second) {
185 TF_RETURN_IF_ERROR(InsertDebugTypeName(type.hash_code(), type.name()));
186 return Status::OK();
187 }
188 return errors::AlreadyExists("Resource ", container, "/", name, "/",
189 type.name());
190}
191
192Status ResourceMgr::DoLookup(const string& container, TypeIndex type,
193 const string& name,

Callers

nothing calls this directly

Calls 6

KeyFunction · 0.70
nameMethod · 0.65
hash_codeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected