MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / Init

Method Init

oneflow/core/framework/device.cpp:50–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 hash_value_(Hash(type, device_id, rematable)) {}
49
50Maybe<void> Device::Init() {
51 if (type_ == "auto") { return Maybe<void>::Ok(); }
52 enum_type_ = JUST(DeviceType4DeviceTag(type()));
53 {
54 DeviceType dev_type = enum_type_;
55 if (dev_type == kMockDevice) { dev_type = DeviceType::kCPU; }
56 mem_case_ = memory::MakeMemCaseShared(enum_type_, device_id_);
57 }
58 return Maybe<void>::Ok();
59}
60
61/* static */ Maybe<Symbol<Device>> Device::New(const std::string& type, int64_t device_id,
62 bool rematable) {

Callers 8

NewMethod · 0.45
ParseAndNewMethod · 0.45
NewFunction · 0.45
NewFunction · 0.45
NaiveInterpretFunction · 0.45
NewFunction · 0.45

Calls 3

DeviceType4DeviceTagFunction · 0.85
typeEnum · 0.85
MakeMemCaseSharedFunction · 0.85

Tested by

no test coverage detected