Skip to content
Snippets Groups Projects
Commit 7ec8b5d6 authored by Houssem ROUIS's avatar Houssem ROUIS
Browse files

changed attrs to int32

parent 51ea7d74
No related branches found
No related tags found
2 merge requests!50version 0.2.0,!20Vit operators
...@@ -40,12 +40,12 @@ void GatherImpl_cpu_forward_kernel(const typename Gather_Op::Attrs& attrs, const ...@@ -40,12 +40,12 @@ void GatherImpl_cpu_forward_kernel(const typename Gather_Op::Attrs& attrs, const
preAxisElems *= inputDims[i]; preAxisElems *= inputDims[i];
} }
const std::vector<std::int64_t> indices = std::get<0>(attrs); const std::vector<std::int32_t> indices = std::get<0>(attrs);
for (std::size_t i=0; i<preAxisElems; ++i) for (std::size_t i=0; i<preAxisElems; ++i)
{ {
for(std::size_t j=0; j<indices.size(); ++j) for(std::size_t j=0; j<indices.size(); ++j)
{ {
const std::size_t idx = indices[j] >= 0 ? indices[j] : indices[j] + inputDims[axisIdx]; const std::size_t idx = indices[j] >= 0 ? indices[j] : static_cast<std::size_t>(indices[j]) + inputDims[axisIdx];
const I* startPtr = std::next(input, i * postAxisElems * inputDims[axisIdx] + idx * postAxisElems); const I* startPtr = std::next(input, i * postAxisElems * inputDims[axisIdx] + idx * postAxisElems);
std::copy_n(startPtr, postAxisElems, output); std::copy_n(startPtr, postAxisElems, output);
output += postAxisElems; output += postAxisElems;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment