-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat fused_adamw #938
feat fused_adamw #938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上单元测试
std::vector<diopiTensorHandle_t> diopiTensorHandles_self(self.size()); | ||
for(size_t i=0; i < self.size(); ++i){ | ||
diopiConstTensorHandle_t const_handle = dipu::diopi_helper::toDiopiTensorHandle(self.at(i)); | ||
diopiTensorHandle_t handle = const_cast<diopiTensorHandle_t>(const_handle); | ||
diopiTensorHandles_self[i] = handle; | ||
} | ||
std::vector<diopiConstTensorHandle_t> diopiTensorHandles_grads(grads.size()); | ||
for(size_t i=0; i < grads.size(); ++i){ | ||
diopiTensorHandles_grads[i] = dipu::diopi_helper::toDiopiTensorHandle(grads.at(i)); | ||
} | ||
std::vector<diopiTensorHandle_t> diopiTensorHandles_exp_avgs(exp_avgs.size()); | ||
for(size_t i=0; i < exp_avgs.size(); ++i){ | ||
diopiConstTensorHandle_t const_handle = dipu::diopi_helper::toDiopiTensorHandle(exp_avgs.at(i)); | ||
diopiTensorHandle_t handle = const_cast<diopiTensorHandle_t>(const_handle); | ||
diopiTensorHandles_exp_avgs[i] = handle; | ||
} | ||
std::vector<diopiTensorHandle_t> diopiTensorHandles_exp_avg_sqs(exp_avg_sqs.size()); | ||
for(size_t i=0; i < exp_avg_sqs.size(); ++i){ | ||
diopiConstTensorHandle_t const_handle = dipu::diopi_helper::toDiopiTensorHandle(exp_avg_sqs.at(i)); | ||
diopiTensorHandle_t handle = const_cast<diopiTensorHandle_t>(const_handle); | ||
diopiTensorHandles_exp_avg_sqs[i] = handle; | ||
} | ||
std::vector<diopiTensorHandle_t> diopiTensorHandles_max_exp_avg_sqs(max_exp_avg_sqs.size()); | ||
for(size_t i=0; i < max_exp_avg_sqs.size(); ++i){ | ||
diopiConstTensorHandle_t const_handle = dipu::diopi_helper::toDiopiTensorHandle(max_exp_avg_sqs.at(i)); | ||
diopiTensorHandle_t handle = const_cast<diopiTensorHandle_t>(const_handle); | ||
diopiTensorHandles_max_exp_avg_sqs[i] = handle; | ||
} | ||
std::vector<diopiConstTensorHandle_t> diopiTensorHandles_state_steps(state_steps.size(), nullptr); | ||
for(size_t i=0; i < state_steps.size(); ++i){ | ||
diopiTensorHandles_state_steps[i] = dipu::diopi_helper::toDiopiTensorHandle(state_steps.at(i)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
削减重复代码,考虑:
- 提取函数
- 使用 std::transform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toDiopiTensorHandleVector
已经有这个函数了
), | ||
) | ||
|
||
@onlyOn("CUDA") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果期望所有芯片都实现,应该用 skipon 比较好
No description provided.