Skip to content
Snippets Groups Projects
Commit 48de8d5d authored by Michal Szczepanski's avatar Michal Szczepanski
Browse files

AllowDataDependency added for resize operator.

parent 8927fffc
No related branches found
No related tags found
2 merge requests!152Update Aidge export to take a graph view has an argument instead of a...,!125Operator resize
......@@ -78,7 +78,7 @@ public:
return std::make_shared<Resize_Op>(*this);
}
// function see inputs
bool dimsForwarded() const override final;
bool forwardDims(bool allowDataDependency = false) override final;
void setBackend(const std::string& name, DeviceIdx_t device = 0) override final;
......
......@@ -25,6 +25,19 @@
const std::string Aidge::Resize_Op::Type = "Resize";
bool Aidge::Resize_Op::dimsForwarded() const {
if ((getInput(1) && !getInput(1)->empty())
|| (getInput(2) && !getInput(2)->empty())
|| (getInput(3) && !getInput(3)->empty()))
{
// output dims are data dependent
return false;
}
return OperatorTensor::dimsForwarded();
}
bool Aidge::Resize_Op::forwardDims(bool allowDataDependency) {
AIDGE_ASSERT(getInput(0)->nbDims() == 4,\
......@@ -35,12 +48,6 @@ bool Aidge::Resize_Op::forwardDims(bool allowDataDependency) {
if (!getInput(i)) {
AIDGE_THROW_OR_ABORT(std::runtime_error, "{}: input #{} not provided", type(), i);
}
if (!allowDataDependency) {
Log::warn("Resize_Op: unable to forwardDims() because output dims are data dependent\
on input#0 and (input#2 or input#3)");
return false;
}
}
if (this->template getAttr<ResizeAttr::NoROI>() && this->template getAttr<ResizeAttr::NoSizes>()) {
......@@ -49,6 +56,11 @@ bool Aidge::Resize_Op::forwardDims(bool allowDataDependency) {
fmt::print("Condition scales: Input#0 and Input#2 must be provided and must have the same dimension,\
while Inputs#1 and #3 must not be provided.\n");
*/
if (!allowDataDependency) {
Log::warn("Resize_Op: unable to forwardDims() because output dims are data dependent\
on input#0 and input#2");
return false;
}
AIDGE_ASSERT(getInput(0)->nbDims() == getInput(2)->size(),\
"input tensor and Scales must have the same dimensions.");
......@@ -73,6 +85,12 @@ bool Aidge::Resize_Op::forwardDims(bool allowDataDependency) {
while Inputs#1 and #2 must not be provided.\n");
*/
if (!allowDataDependency) {
Log::warn("Resize_Op: unable to forwardDims() because output dims are data dependent\
on input#0 and input#3)");
return false;
}
AIDGE_ASSERT(getInput(0)->nbDims() == getInput(3)->size(),\
"input tensor and Sizes must have the same dimensions.");
......
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