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

Method Create

tensorflow/compiler/xrt/client/xrt_client.cc:479–496  ·  view source on GitHub ↗

static*/

Source from the content-addressed store, hash-verified

477}
478
479/*static*/ xla::StatusOr<std::shared_ptr<XrtContext>> XrtContext::Create(
480 std::shared_ptr<XrtTfContext> tf_context, string device_type) {
481 auto context = std::make_shared<XrtContext>(tf_context, device_type);
482 if (context->tf_device_ids().empty()) {
483 return errors::NotFound("No accelerator devices of type ", device_type,
484 " are present.");
485 }
486 if (device_type == "TPU") {
487 TF_RETURN_IF_ERROR(context->InitializeTPU());
488 } else {
489 // Fill in a dummy topology mapping for CPU/GPU.
490 for (int i = 0; i < context->tf_device_ids().size(); ++i) {
491 context->device_mesh_coordinates_.push_back({});
492 context->device_mesh_coordinates_.back().add_value(i);
493 }
494 }
495 return context;
496}
497
498XrtContext::XrtContext(std::shared_ptr<XrtTfContext> tf_context,
499 string device_type)

Callers 1

TEST_FFunction · 0.45

Calls 6

NotFoundFunction · 0.85
InitializeTPUMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
backMethod · 0.45

Tested by 1

TEST_FFunction · 0.36