| 291 | } |
| 292 | |
| 293 | std::string FusedElmwiseKernel::GetKernelSymbol(TContext* context) const { |
| 294 | size_t nr_operands = context->getAttrInt("nr_operands"); |
| 295 | auto dst_operand = |
| 296 | context->getAttrOprand("operand:" + std::to_string(nr_operands - 1)); |
| 297 | std::stringstream ss; |
| 298 | ss << "kernel_naive_fused_elementwise"; |
| 299 | auto mode_size = context->getAttrInt("modes:size"); |
| 300 | for (int i = 0; i < mode_size; i++) { |
| 301 | auto modes = Utils::split_string( |
| 302 | context->getAttrStr("modes:" + std::to_string(i)), ','); |
| 303 | size_t modes_size = modes.size(); |
| 304 | auto mode = modes[modes_size - 2]; |
| 305 | ss << "_" << mode; |
| 306 | } |
| 307 | for (size_t i = 0; i < nr_operands; i++) { |
| 308 | auto operand = context->getAttrOprand("operand:" + std::to_string(i)); |
| 309 | auto tensor_type = GetOperandTensorType(dst_operand, operand); |
| 310 | ss << "_tensortype" << tensor_type; |
| 311 | } |
| 312 | ss << "_" << SymbolHelper::gen_io_str(context); |
| 313 | return ss.str(); |
| 314 | } |
| 315 | |
| 316 | std::string FusedElmwiseKernel::GetKernelBody(TContext* context) const { |
| 317 | size_t nr_operands = context->getAttrInt("nr_operands"); |
nothing calls this directly
no test coverage detected