| 234 | } |
| 235 | |
| 236 | mluOpStatus_t binaryOpParamSameShapeCheck( |
| 237 | const std::string &op_name, const mluOpTensorDescriptor_t input1_desc, |
| 238 | const mluOpTensorDescriptor_t input2_desc, |
| 239 | const mluOpTensorDescriptor_t output_desc) { |
| 240 | // check dim |
| 241 | PARAM_CHECK_EQ("[" + op_name + "]", input1_desc->getDim(), |
| 242 | input2_desc->getDim()); |
| 243 | PARAM_CHECK_EQ("[" + op_name + "]", input1_desc->getDim(), |
| 244 | output_desc->getDim()); |
| 245 | |
| 246 | // check shape |
| 247 | for (int i = 0; i < input1_desc->getDim(); i++) { |
| 248 | if (input1_desc->getDimIndex(i) != input2_desc->getDimIndex(i)) { |
| 249 | LOG(ERROR) << op_name << ":The shape of input1 should be equal to input2" |
| 250 | << ". But now input1's shape[" << i << "] is " |
| 251 | << input1_desc->getDimIndex(i) << ", input2's shape[" << i |
| 252 | << "] is " << input2_desc->getDimIndex(i) << "."; |
| 253 | return MLUOP_STATUS_BAD_PARAM; |
| 254 | } |
| 255 | if (input1_desc->getDimIndex(i) != output_desc->getDimIndex(i)) { |
| 256 | LOG(ERROR) << op_name << ":The shape of input1 should be equal to output" |
| 257 | << ". But now input1's shape[" << i << "] is " |
| 258 | << input1_desc->getDimIndex(i) << ", output's shape[" << i |
| 259 | << "] is " << output_desc->getDimIndex(i) << "."; |
| 260 | return MLUOP_STATUS_BAD_PARAM; |
| 261 | } |
| 262 | } |
| 263 | return MLUOP_STATUS_SUCCESS; |
| 264 | } |
| 265 | |
| 266 | std::string array2String(int32_t dim_num, const int64_t *dims) { |
| 267 | std::string res; |
no test coverage detected