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

Method ResetSession

tensorflow/core/grappler/clusters/single_machine.cc:344–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344Status SingleMachine::ResetSession() {
345 if (session_) {
346 LOG(INFO) << "Cleaning up previous session";
347
348 // Make sure the session is properly closed
349 TF_RETURN_IF_ERROR(ShutdownSession());
350
351 // Destroying the object deletes all its variables as well. This is only
352 // true for DirectSession.
353 session_.reset();
354 }
355
356 LOG(INFO) << "Starting new session";
357
358 // Create a new threadpool
359 thread_pool_.reset(new thread::ThreadPool(
360 Env::Default(), SanitizeThreadSuffix("single_machine"), 2));
361
362 session_.reset(NewSession(options_));
363 if (!session_) {
364 return errors::Unknown("Failed to create session");
365 }
366 coordinator_.reset(new Coordinator());
367
368 // Build the DeviceSet.
369 device_set_.reset(new DeviceSet);
370 const DeviceMgr* device_mgr;
371 TF_RETURN_IF_ERROR(session_->LocalDeviceManager(&device_mgr));
372 for (auto d : device_mgr->ListDevices()) {
373 device_set_->AddDevice(d);
374 // We currently don't care about the client device.
375 }
376
377 return Status::OK();
378}
379
380void SingleMachine::MergeCosts(CostGraphDef* graph_costs,
381 const CostGraphDef& init_costs,

Callers

nothing calls this directly

Calls 8

DefaultFunction · 0.85
SanitizeThreadSuffixFunction · 0.85
NewSessionFunction · 0.50
UnknownClass · 0.50
resetMethod · 0.45
LocalDeviceManagerMethod · 0.45
ListDevicesMethod · 0.45
AddDeviceMethod · 0.45

Tested by

no test coverage detected