Skip to content
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

[Feature](mluOpAdamW): add param check for adam_w #984

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions kernels/adam_w/adam_w.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ mluOpAdamW(mluOpHandle_t handle, const mluOpAdamWDescriptor_t adamw_desc,
PARAM_CHECK("[mluOpAdamW]", momentum_desc != nullptr);
PARAM_CHECK("[mluOpAdamW]", velocity_desc != nullptr);
PARAM_CHECK("[mluOpAdamW]", grad_desc != nullptr);
PARAM_CHECK("[mluOpAdamW]", param_desc->dtype == MLUOP_DTYPE_FLOAT)
PARAM_CHECK("[mluOpAdamW]", paramh_desc->dtype == MLUOP_DTYPE_BFLOAT16)
PARAM_CHECK("[mluOpAdamW]", momentum_desc->dtype == MLUOP_DTYPE_FLOAT)
PARAM_CHECK("[mluOpAdamW]", velocity_desc->dtype == MLUOP_DTYPE_FLOAT)
PARAM_CHECK("[mluOpAdamW]", grad_desc->dtype == MLUOP_DTYPE_BFLOAT16)

PARAM_CHECK_LE("[mluOpAdamW]", beta1, 1.0)
PARAM_CHECK_GE("[mluOpAdamW]", beta1, 0.0)
PARAM_CHECK_LE("[mluOpAdamW]", beta2, 1.0)
PARAM_CHECK_GE("[mluOpAdamW]", beta2, 0.0)
PARAM_CHECK("[mluOpAdamW]", epsilon > 0)

size_t param_dims = 0;
size_t paramh_dims = 0;
Expand Down
Loading