Skip to content

Commit

Permalink
[onert] Fix SGD update rule (#11257)
Browse files Browse the repository at this point in the history
This commit fixes SGD update rule.
- `w = w - learning_rate * g`

ONE-DCO-1.0-Signed-off-by: Jiyoung Yun <[email protected]>
  • Loading branch information
jyoungyun authored Aug 17, 2023
1 parent 015e3e9 commit c3afc94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/onert/core/src/exec/train/optimizer/SGD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void SGD::applyGradient(const UpdateFactors &factors) const
{
case ir::DataType::FLOAT32:
elementwise<float>(shape, grad_tensor, trainable_tensor,
[&](float dst, float src) -> float { return dst + src * lr; });
[&](float src, float dst) -> float { return dst - src * lr; });
break;
default:
throw std::runtime_error("SGD: Not supported data type");
Expand Down

0 comments on commit c3afc94

Please sign in to comment.