Skip to content
Snippets Groups Projects
Commit a23bb0cf authored by Maxence Naud's avatar Maxence Naud
Browse files

[Fix] Slice kernel picking the wrong values from input

parent 09deddee
No related branches found
No related tags found
2 merge requests!22Update operators implementation,!16Draft: Tiling
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#define AIDGE_CPU_OPERATOR_SLICEIMPL_FORWARD_KERNEL_H_ #define AIDGE_CPU_OPERATOR_SLICEIMPL_FORWARD_KERNEL_H_
#include "aidge/utils/Registrar.hpp" #include "aidge/utils/Registrar.hpp"
#include "aidge/operator/Slice.hpp"
#include "aidge/backend/cpu/operator/SliceImpl.hpp"
#include <array> #include <array>
#include <cstddef> #include <cstddef>
...@@ -20,7 +22,7 @@ ...@@ -20,7 +22,7 @@
namespace Aidge { namespace Aidge {
template <class I, std::size_t DIM> template <class I, std::size_t DIM>
void SliceImpl_cpu_forward_kernel(const Slice_Op::Attrs& attrs, void SliceImpl_cpu_forward_kernel(const typename Slice_Op<DIM>::Attrs& attrs,
const std::array<std::size_t, DIM> inputDims, const std::array<std::size_t, DIM> inputDims,
const void* input_, const void* input_,
void* output_) { void* output_) {
...@@ -48,8 +50,9 @@ void SliceImpl_cpu_forward_kernel(const Slice_Op::Attrs& attrs, ...@@ -48,8 +50,9 @@ void SliceImpl_cpu_forward_kernel(const Slice_Op::Attrs& attrs,
std::size_t j = 0; std::size_t j = 0;
std::size_t i = 0; std::size_t i = 0;
for (; j < prodSlicedDims[0]; ++j) { for (; j < prodSlicedDims[0];) {
output[j] = input[i++]; output[j] = input[i++];
++j;
for (std::size_t idx = DIM - 1; idx > 0; --idx) { for (std::size_t idx = DIM - 1; idx > 0; --idx) {
i += j % prodSlicedDims[idx] == 0 ? substractedDims[idx]*prodInputDims[idx+1] : 0; i += j % prodSlicedDims[idx] == 0 ? substractedDims[idx]*prodInputDims[idx+1] : 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment