REQUIRE_TRUE(expectedPaddingsShape==currentPaddingsShape,0,"PAD op: wrong shape of paddings array, expected is %s, but got %s instead !",expectedPaddingsShape.c_str(),currentPaddingsShape.c_str());
// in case of REFLECT and SYMMETRIC modes paddings must obey additional shape requirements
if(INT_ARG(0)==0){// CONSTANT mode
if(block.width()>2){
REQUIRE_TRUE(input->dataType()==INPUT_VARIABLE(2)->dataType(),0,"PAD op: data types of input and padValue arrays should be the same but got %i and %i correspondingly !",input->dataType(),INPUT_VARIABLE(2)->dataType());
padValue.assign(INPUT_VARIABLE(2)->e(0));
}
elseif(!block.getTArguments()->empty())
padValue=T_ARG(0);
}
elseif(INT_ARG(0)==1){// REFLECT mode
for(intdim=0;dim<rank;++dim)
REQUIRE_TRUE(paddings->e<Nd4jLong>(dim,0)<=(input->shapeOf()[dim]-1)&&paddings->e<Nd4jLong>(dim,1)<=(input->shapeOf()[dim]-1),0,"PAD op: wrong content of paddings array for REFLECT mode !");
}
if(INT_ARG(0)==2){// SYMMETRIC mode
for(intdim=0;dim<rank;++dim)
REQUIRE_TRUE(paddings->e<Nd4jLong>(dim,0)<=input->shapeOf()[dim]&&paddings->e<Nd4jLong>(dim,1)<=input->shapeOf()[dim],0,"PAD op: wrong content of paddings array for SYMMETRIC mode !");
}
// CONSTANT->0, REFLECT->1, SYMMETRIC->2
REQUIRE_TRUE(INT_ARG(0)>=0&&INT_ARG(0)<=2,0,"PAD op: unknown padding mode, there are only three possible legal values -> 0,1,2, but got %i instead !",INT_ARG(0));
// std::vector<int> dimensions(input->rankOf());
// std::iota(dimensions.begin(), dimensions.end(), 0); // fill with 0, 1, ... rank-1
REQUIRE_TRUE(expectedPaddingsShape==currentPaddingsShape,0,"PAD op: wrong shape of paddings array, expected is %s, but got %s instead !",expectedPaddingsShape.c_str(),currentPaddingsShape.c_str());