MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / invoke

Function invoke

csrc/lion/cpu_lion_impl.cpp:173–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171} _invoker_initializer;
172
173void invoke(std::shared_ptr<Lion_Optimizer> opt,
174 torch::Tensor& params,
175 torch::Tensor& grads,
176 torch::Tensor& exp_avg,
177 size_t param_size)
178{
179 c10::ScalarType params_type = at::typeMetaToScalarType(params.options().dtype());
180 c10::ScalarType state_type = at::typeMetaToScalarType(exp_avg.options().dtype());
181
182 auto it = invokers.find(std::tuple(params_type, state_type));
183 if (it == invokers.end()) {
184 throw std::runtime_error("Lion optimizer with param type "s + c10::toString(params_type) +
185 " and state type "s + c10::toString(state_type) +
186 " is not supported on current hardware"s);
187 }
188
189 it->second(opt, params.data_ptr(), grads.data_ptr(), exp_avg.data_ptr(), param_size);
190}
191
192int ds_lion_step(int optimizer_id,
193 size_t step,

Callers 1

ds_lion_stepFunction · 0.70

Calls 2

dtypeMethod · 0.45
data_ptrMethod · 0.45

Tested by

no test coverage detected