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

Function DefaultGenerator

oneflow/core/framework/random_generator.cpp:128–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128Maybe<Generator> DefaultGenerator(const std::string& device, int device_index) {
129 static auto* default_auto_generator =
130 dynamic_cast<AutoGenerator*>(JUST(DefaultAutoGenerator())->internal().get());
131 if (device_index == -1) { device_index = (device == "cpu" ? 0 : GlobalProcessCtx::LocalRank()); }
132 return std::make_shared<Generator>(
133 JUST(default_auto_generator->GetOrCreate(device, device_index)));
134}
135
136Maybe<Generator> DefaultAutoGenerator() {
137 // Skip destructing to avoid calling symbols in other dynamic libraries when the global object is

Callers 4

DefaultCPUGeneratorFunction · 0.85
DefaultCUDAGeneratorFunction · 0.85
ManualSeedFunction · 0.85

Calls 4

DefaultAutoGeneratorFunction · 0.85
DeviceTag4DeviceTypeFunction · 0.85
getMethod · 0.45
GetOrCreateMethod · 0.45

Tested by

no test coverage detected