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

[onert-micro] Fix MaxPool2D and FullyConnected training kernels #14486

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion onert-micro/onert-micro/src/train/kernels/FullyConnected.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ OMStatus onert_micro::train::train_kernel_CircleFullyConnected(const OMBackpropE

// 2. Calculate weight gradient
// Init weight grads with zeros
for (int i = 0; i < output_shape.dims(1) * input_shape.dims(1); i += sizeof(float))
const auto kDlossSizeInBytes = output_shape.dims(1) * input_shape.dims(1) * sizeof(float);
for (int i = 0; i < kDlossSizeInBytes; i += sizeof(float))
*static_cast<float *>(static_cast<void *>(dloss_dweight_data + i)) = 0;

pal::FullyConnectedWeightGrad(
Expand Down
2 changes: 1 addition & 1 deletion onert-micro/onert-micro/src/train/kernels/MaxPool2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ OMStatus onert_micro::train::train_kernel_CircleMaxPool2D(const OMBackpropExecut
params.filter_w = options->filter_width();

// Set input grad to zero
for (size_t i = 0; i < input_shape.flatSize(); i += sizeof(float))
for (size_t i = 0; i < input_shape.flatSize() * sizeof(float); i += sizeof(float))
*static_cast<float *>(static_cast<void *>(dloss_dinput_data + i)) = 0;

// Calculate input grad
Expand Down