Skip to content
Snippets Groups Projects
Commit 7ddf2ee5 authored by Gallas Gaye's avatar Gallas Gaye
Browse files

feat: Reshape is a noop if the inputs and ouputs points to the same buffer

parent 8dd89f61
No related branches found
No related tags found
No related merge requests found
Pipeline #67940 failed
......@@ -13,8 +13,12 @@ void reshape_forward (
const Input_T* __restrict inputs2,
Output_T* __restrict outputs)
{
// If inputs and outputs pointers are the same, the memory manager has already optimized this function so it is a no-op !
if (inputs2 == outputs)
return;
// A reshape in c++ world should equal to a Noop
// Need to check if memory wise we can just skip this operation
// We only need to copy the input buffer to the output
for (int m = 0; m < M; ++m) {
outputs[m] = inputs2[m];
}
......
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