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

move depthtospace channel size / blocksize assertion to forwarddims

parent ca784b95
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,6 @@ void Aidge::DepthToSpace_OpImpl::forward() { ...@@ -26,8 +26,6 @@ void Aidge::DepthToSpace_OpImpl::forward() {
// Get input dimensions // Get input dimensions
const auto& dims = op.getInput(0)->dims<4>(); const auto& dims = op.getInput(0)->dims<4>();
// Assert that c is divisible by blocksize squared
assert(dims[1] % (op.blockSize() * op.blockSize()) == 0 && "Number of channels must be divisible by blocksize squared");
// get final output dimension // get final output dimension
const std::array<DimSize_t, 4> final_dims = op.getOutput(0)->dims<4>(); const std::array<DimSize_t, 4> final_dims = op.getOutput(0)->dims<4>();
...@@ -63,6 +61,7 @@ const std::string Aidge::DepthToSpace_Op::Type = "DepthToSpace"; ...@@ -63,6 +61,7 @@ const std::string Aidge::DepthToSpace_Op::Type = "DepthToSpace";
bool Aidge::DepthToSpace_Op::forwardDims(bool /*allowDataDependency*/) { bool Aidge::DepthToSpace_Op::forwardDims(bool /*allowDataDependency*/) {
if (inputsAssociated()) { if (inputsAssociated()) {
AIDGE_ASSERT(getInput(0)->nbDims() == 4, "{} Operator only accepts 4-D input Tensors.", DepthToSpace_Op::Type); AIDGE_ASSERT(getInput(0)->nbDims() == 4, "{} Operator only accepts 4-D input Tensors.", DepthToSpace_Op::Type);
AIDGE_ASSERT(getInput(0)->dims()[1] % (blockSize() * blockSize()) == 0, "Number of channels must be divisible by blocksize squared");
// Compute output dims // Compute output dims
const std::array<DimSize_t, 4>& inDims = getInput(0)->dims<4>(); const std::array<DimSize_t, 4>& inDims = getInput(0)->dims<4>();
......
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