| 57 | return writer.str(); |
| 58 | } |
| 59 | std::string gen_write(std::string mode, std::string acc, std::string size) { |
| 60 | std::stringstream writer; |
| 61 | if (mode == "MAX" || mode == "SUM" || mode == "MIN" || mode == "PRODUCT" || |
| 62 | mode == "SUM_SQR") { |
| 63 | writer << acc; |
| 64 | } else if (mode == "MEAN") { |
| 65 | writer << acc << " / (" << size << ")"; |
| 66 | } else { |
| 67 | CC_ABORT << "unknown reduce mode " << mode.c_str() << "\n"; |
| 68 | } |
| 69 | return writer.str(); |
| 70 | } |
| 71 | } // namespace |
| 72 | |
| 73 | bool ReduceKernel::IsAvailable(TContext* context) const { |