| 29 | class GetBinaryFeature: public AsyncOpKernel { |
| 30 | public: |
| 31 | explicit GetBinaryFeature(OpKernelConstruction* ctx): AsyncOpKernel(ctx) { |
| 32 | OP_REQUIRES_OK(ctx, ctx->GetAttr("N", &N_)); |
| 33 | OP_REQUIRES_OK(ctx, ctx->GetAttr("feature_names", &feature_names_)); |
| 34 | std::stringstream ss; |
| 35 | ss << "v(nodes).values("; |
| 36 | for (size_t i = 0; i < feature_names_.size(); ++i) { |
| 37 | if (i != 0) { |
| 38 | ss << ","; |
| 39 | } |
| 40 | ss << "__" << feature_names_[i]; |
| 41 | } |
| 42 | ss << ").as(fea)"; |
| 43 | query_str_ = ss.str(); |
| 44 | for (size_t i = 0; i < feature_names_.size() * 2; ++i) { |
| 45 | ss.str(""); |
| 46 | ss << "fea:" << i; |
| 47 | res_names_.emplace_back(ss.str()); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override; |
| 52 | |