| 126 | } |
| 127 | |
| 128 | Maybe<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 | |
| 136 | Maybe<Generator> DefaultAutoGenerator() { |
| 137 | // Skip destructing to avoid calling symbols in other dynamic libraries when the global object is |
no test coverage detected