Skip to content
Snippets Groups Projects
Commit 3d9f7779 authored by Olivier BICHLER's avatar Olivier BICHLER Committed by Maxence Naud
Browse files

Make Shape working with forwardDims()

parent 269145ad
No related branches found
No related tags found
2 merge requests!279v0.4.0,!267Fixed issues for LSTM
......@@ -20,14 +20,8 @@
#include "aidge/utils/Types.h"
void Aidge::Shape_OpImpl::forward() {
const Shape_Op& op = dynamic_cast<const Shape_Op&>(mOp);
const auto start = op.start();
const auto end = op.end();
op.getOutput(0)->getImpl()->copyCast(std::next(op.getInput(0)->dims().data(),
start),
DataType::UInt64,
end - start + 1);
// Do nothing...
// Output is already valid after forwardDims()
}
///////////////////////////////////////////////
......@@ -75,6 +69,11 @@ bool Aidge::Shape_Op::forwardDims(bool /*allowDataDependency*/) {
AIDGE_ASSERT(roi> 1, "Invalid ROI for Shape");
mOutputs[0]->resize({roi});
// Ensure the output of this operator is valid after forwardDims():
mOutputs[0]->getImpl()->copyCast(std::next(getInput(0)->dims().data(),
start),
DataType::UInt64,
end - start + 1);
return true;
}
......
  • Maintainer

    @olivierbichler this commit is annoying.

    Indeed this force Shape to have an implementation in order to run forward_dims, otherwise mOutputs[0]->getImpl() -> 0x0.

    Is it possible to revert it? If so I would like ot do it in !291 (merged)

  • Olivier BICHLER @olivierbichler ·
    Author Maintainer

    @cmoineau But Shape is supposed to have a default implementation, in which case this is an issue?

  • Maintainer

    In case we do the import of an ONNX followed by a forward dims followed by an ONNX export. In this case we don't have access to any backend of intermediate tensor.

    Edited by Cyril Moineau
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