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

[Draft] Fix accuracy #13942

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
18 changes: 9 additions & 9 deletions runtime/onert/core/src/backend/builtin/train/KernelGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ void KernelGenerator::visit(const ir::train::operation::Permute &node)
for (uint32_t i = 0; i < input_tensors.size(); i++)
permute_types.emplace_back(ir::PermuteType::COPY);

// NOTE The output buffers of IOTensors are not essential for training. If there
// is no output buffer provided by the user, permute is not performed.
bool ignore_forward_in_training = false;
for (const auto dst_tensor : output_tensors)
{
if (dst_tensor->buffer() == nullptr || dst_tensor->total_size() == 0)
ignore_forward_in_training = true;
}
// // NOTE The output buffers of IOTensors are not essential for training. If there
// // is no output buffer provided by the user, permute is not performed.
// bool ignore_forward_in_training = false;
// for (const auto dst_tensor : output_tensors)
// {
// if (dst_tensor->buffer() == nullptr || dst_tensor->total_size() == 0)
// ignore_forward_in_training = true;
// }

auto fn = std::make_unique<kernel::PermuteLayer>(
input_tensors, output_tensors, input_back_prop_tensors, output_back_prop_tensors, permute_types,
ignore_forward_in_training, _external_context);
_external_context);

_return_fn = std::move(fn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ PermuteLayer::PermuteLayer(const std::vector<ITensor *> &src_tensors,
const std::vector<ITensor *> &input_back_prop_tensors,
const std::vector<ITensor *> &output_back_prop_tensors,
const std::vector<ir::PermuteType> &types,
bool ignore_forward_in_training,
// bool ignore_forward_in_training,
const std::shared_ptr<ExternalContext> &external_context)
: builtin::kernel::PermuteLayer{src_tensors, dst_tensors, types, external_context},
_input_back_prop_tensors{input_back_prop_tensors},
_output_back_prop_tensors{output_back_prop_tensors},
_ignore_forward_in_training{ignore_forward_in_training}
_output_back_prop_tensors{output_back_prop_tensors} //,
// _ignore_forward_in_training{ignore_forward_in_training}
{
assert(input_back_prop_tensors.size() == output_back_prop_tensors.size());
assert(src_tensors.size() == dst_tensors.size());
Expand All @@ -54,8 +54,13 @@ void PermuteLayer::optimize()

void PermuteLayer::forward(bool)
{
if (_ignore_forward_in_training)
return;
// if (_ignore_forward_in_training)
// return;
for (const auto &dst_tensor : _dst_tensors)
{
if (dst_tensor->buffer() == nullptr || dst_tensor->total_size() == 0)
return;
}

builtin::kernel::PermuteLayer::run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PermuteLayer : public builtin::kernel::PermuteLayer, public exec::train::I
PermuteLayer(const std::vector<ITensor *> &src_tensors, const std::vector<ITensor *> &dst_tensors,
const std::vector<ITensor *> &input_back_prop_tensors,
const std::vector<ITensor *> &output_back_prop_tensors,
const std::vector<ir::PermuteType> &types, bool ignore_forward_in_training,
const std::vector<ir::PermuteType> &types,
const std::shared_ptr<ExternalContext> &external_context);

void optimize() override;
Expand All @@ -49,7 +49,7 @@ class PermuteLayer : public builtin::kernel::PermuteLayer, public exec::train::I
private:
std::vector<ITensor *> _input_back_prop_tensors;
std::vector<ITensor *> _output_back_prop_tensors;
bool _ignore_forward_in_training;
// bool _ignore_forward_in_training;
};

} // namespace kernel
Expand Down