REQUIRE_TRUE(expectedPaddingsShape==currentPaddingsShape,0,"PAD op: wrong shape of paddings array, expected is %s, but got %s instead !",ShapeUtils::shapeAsString(expectedPaddingsShape).c_str(),ShapeUtils::shapeAsString(currentPaddingsShape).c_str());
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 !",ShapeUtils::shapeAsString(expectedPaddingsShape).c_str(),ShapeUtils::shapeAsString(currentPaddingsShape).c_str());