REQUIRE_TRUE(diagonal->rankOf()==input->rankOf()-1,0,"MATRIX_SET_DIAG op: rank of diagonal array must be smaller by one compared to rank of input array, but got %i and %i correspondingly !",diagonal->rankOf(),input->rankOf());
for(inti=0;i<diagonal->rankOf()-1;++i)
REQUIRE_TRUE(diagonal->sizeAt(i)==input->sizeAt(i),0,"MATRIX_SET_DIAG op: the shapes of diagonal and input arrays must be equal till last diagonal dimension but one, however got diagonal=%s and input=%s instead !",ShapeUtils::shapeAsString(diagonal).c_str(),ShapeUtils::shapeAsString(input).c_str());
REQUIRE_TRUE(diagonal->sizeAt(-1)==(int)nd4j::math::nd4j_min<Nd4jLong>(input->sizeAt(-1),input->sizeAt(-2)),0,"MATRIX_SET_DIAG op: the value of last dimension of diagonal array must be equal to min(input_last_shape=%i, input_last_but_one_shape=%i), but got %i instead !",input->sizeAt(-1),input->sizeAt(-2),diagonal->sizeAt(-1));